trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1228303 - in /trafficserver/traffic/trunk: CHANGES iocore/hostdb/HostDB.cc iocore/hostdb/I_HostDBProcessor.h iocore/hostdb/P_HostDB.h iocore/hostdb/P_HostDBProcessor.h proxy/InkAPI.cc proxy/api/ts/ts.h.in
Date Fri, 06 Jan 2012 17:50:27 GMT
Author: zwoop
Date: Fri Jan  6 17:50:27 2012
New Revision: 1228303

URL: http://svn.apache.org/viewvc?rev=1228303&view=rev
Log:
TS-1040 teach TSHostLookup to use const. Author: James Peach.

Modified:
    trafficserver/traffic/trunk/CHANGES
    trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc
    trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h
    trafficserver/traffic/trunk/iocore/hostdb/P_HostDB.h
    trafficserver/traffic/trunk/iocore/hostdb/P_HostDBProcessor.h
    trafficserver/traffic/trunk/proxy/InkAPI.cc
    trafficserver/traffic/trunk/proxy/api/ts/ts.h.in

Modified: trafficserver/traffic/trunk/CHANGES
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/CHANGES?rev=1228303&r1=1228302&r2=1228303&view=diff
==============================================================================
--- trafficserver/traffic/trunk/CHANGES (original)
+++ trafficserver/traffic/trunk/CHANGES Fri Jan  6 17:50:27 2012
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.1.2
-  *) TS-1071 Debug statement in FetchSM broken. Author: Brian Geffon.
+  *) [TS-1040] Teach TSHostLookup to use const. Author: James Peach.
+
+  *) [TS-1071] Debug statement in FetchSM broken. Author: Brian Geffon.
 
   *) [TS-1057] Expose Base64-encoding through APIs.
    Author: Yakov Kopel and leif

Modified: trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc?rev=1228303&r1=1228302&r2=1228303&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc (original)
+++ trafficserver/traffic/trunk/iocore/hostdb/HostDB.cc Fri Jan  6 17:50:27 2012
@@ -449,7 +449,7 @@ HostDBProcessor::start(int)
 
 void
 HostDBContinuation::init(
-  char *hostname, int len,
+  const char *hostname, int len,
   sockaddr const* aip,
   INK_MD5 & amd5, Continuation * cont, void *pDS, bool is_srv, int timeout
 ) {
@@ -475,7 +475,7 @@ HostDBContinuation::init(
 
 
 void
-make_md5(INK_MD5 & md5, char *hostname, int len, int port, char *pDNSServers, int srv)
+make_md5(INK_MD5 & md5, const char *hostname, int len, int port, char *pDNSServers, int
srv)
 {
 #ifdef USE_MMH
   MMH_CTX ctx;
@@ -567,7 +567,7 @@ Ldelete:
 
 
 HostDBInfo *
-probe(ProxyMutex *mutex, INK_MD5 & md5, char *hostname, int len, sockaddr const* ip,
void *pDS, bool ignore_timeout,
+probe(ProxyMutex *mutex, INK_MD5 & md5, const char *hostname, int len, sockaddr const*
ip, void *pDS, bool ignore_timeout,
       bool is_srv_lookup)
 {
   ink_debug_assert(this_ethread() == hostDB.lock_for_bucket((int) (fold_md5(md5) % hostDB.buckets))->thread_holding);
@@ -663,7 +663,7 @@ HostDBContinuation::insert(unsigned int 
 //
 Action *
 HostDBProcessor::getby(Continuation * cont,
-                       char *hostname, int len, sockaddr const* ip, bool aforce_dns, int
dns_lookup_timeout)
+                       const char *hostname, int len, sockaddr const* ip, bool aforce_dns,
int dns_lookup_timeout)
 {
   INK_MD5 md5;
   char *pServerLine = 0;
@@ -684,7 +684,7 @@ HostDBProcessor::getby(Continuation * co
   }
 #ifdef SPLIT_DNS
   if (hostname && SplitDNSConfig::isSplitDNSEnabled()) {
-    char *scan = hostname;
+    const char *scan = hostname;
     for (; *scan != '\0' && (ParseRules::is_digit(*scan) || '.' == *scan); scan++);
     if ('\0' != *scan) {
       void *pSD = (void *) SplitDNSConfig::acquire();
@@ -776,7 +776,7 @@ Lretry:
 // Wrapper from getbyname to getby
 //
 Action *
-HostDBProcessor::getbyname_re(Continuation * cont, char *ahostname, int len, int port, int
flags)
+HostDBProcessor::getbyname_re(Continuation * cont, const char *ahostname, int len, int port,
int flags)
 {
   bool force_dns = false;
   EThread *thread = this_ethread();
@@ -799,7 +799,7 @@ HostDBProcessor::getbyname_re(Continuati
 /* Support SRV records */
 Action *
 HostDBProcessor::getSRVbyname_imm(Continuation * cont, process_srv_info_pfn process_srv_info,
-                                  char *hostname, int len, int port, int flags, int dns_lookup_timeout)
+                                  const char *hostname, int len, int port, int flags, int
dns_lookup_timeout)
 {
   ink_debug_assert(cont->mutex->thread_holding == this_ethread());
   bool force_dns = false;
@@ -873,7 +873,7 @@ HostDBProcessor::getSRVbyname_imm(Contin
 //
 Action *
 HostDBProcessor::getbyname_imm(Continuation * cont, process_hostdb_info_pfn process_hostdb_info,
-                               char *hostname, int len, int port, int flags, int dns_lookup_timeout)
+                               const char *hostname, int len, int port, int flags, int dns_lookup_timeout)
 {
   ink_debug_assert(cont->mutex->thread_holding == this_ethread());
   bool force_dns = false;
@@ -905,7 +905,7 @@ HostDBProcessor::getbyname_imm(Continuat
 
 #ifdef SPLIT_DNS
   if (SplitDNSConfig::isSplitDNSEnabled()) {
-    char *scan = hostname;
+    const char *scan = hostname;
     char *pServerLine = 0;
     for (; *scan != '\0' && (ParseRules::is_digit(*scan) || '.' == *scan); scan++);
     if ('\0' != *scan) {
@@ -957,7 +957,7 @@ HostDBProcessor::getbyname_imm(Continuat
 
 
 static void
-do_setby(HostDBInfo * r, HostDBApplicationInfo * app, char *hostname, sockaddr const* ip)
+do_setby(HostDBInfo * r, HostDBApplicationInfo * app, const char *hostname, sockaddr const*
ip)
 {
   HostDBRoundRobin *rr = r->rr();
 
@@ -982,7 +982,7 @@ do_setby(HostDBInfo * r, HostDBApplicati
 
 
 void
-HostDBProcessor::setby(char *hostname, int len, sockaddr const* ip, HostDBApplicationInfo
* app)
+HostDBProcessor::setby(const char *hostname, int len, sockaddr const* ip, HostDBApplicationInfo
* app)
 {
   if (!hostdb_enable)
     return;
@@ -1047,7 +1047,7 @@ HostDBContinuation::setbyEvent(int event
 
 
 static int
-remove_round_robin(HostDBInfo * r, char *hostname, sockaddr const* ip)
+remove_round_robin(HostDBInfo * r, const char *hostname, sockaddr const* ip)
 {
   if (r) {
     if (!r->round_robin)
@@ -1092,7 +1092,7 @@ remove_round_robin(HostDBInfo * r, char 
 
 
 Action *
-HostDBProcessor::failed_connect_on_ip_for_name(Continuation * cont, sockaddr const* ip, char
*hostname, int len)
+HostDBProcessor::failed_connect_on_ip_for_name(Continuation * cont, sockaddr const* ip, const
char *hostname, int len)
 {
   INK_MD5 md5;
   char *pServerLine = 0;

Modified: trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h?rev=1228303&r1=1228302&r2=1228303&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h (original)
+++ trafficserver/traffic/trunk/iocore/hostdb/I_HostDBProcessor.h Fri Jan  6 17:50:27 2012
@@ -429,16 +429,16 @@ struct HostDBProcessor: public Processor
   HostDBProcessor()
   { }
 
-  inkcoreapi Action *getbyname_re(Continuation * cont, char *hostname, int len = 0, int port
= 0,
+  inkcoreapi Action *getbyname_re(Continuation * cont, const char *hostname, int len = 0,
int port = 0,
                                   int flags = HOSTDB_DO_NOT_FORCE_DNS);
 
-  Action *getSRVbyname_imm(Continuation * cont, process_srv_info_pfn process_srv_info, char
*hostname, int len = 0,
+  Action *getSRVbyname_imm(Continuation * cont, process_srv_info_pfn process_srv_info, const
char *hostname, int len = 0,
                            int port = 0, int flags = HOSTDB_DO_NOT_FORCE_DNS, int timeout
= 0);
 
   Action *getbyname_imm(
     Continuation * cont,
     process_hostdb_info_pfn process_hostdb_info,
-    char *hostname,
+    const char *hostname,
     int len = 0,
     int port = 0,
     int flags = HOSTDB_DO_NOT_FORCE_DNS,
@@ -463,7 +463,7 @@ struct HostDBProcessor: public Processor
   Action *failed_connect_on_ip_for_name(
     Continuation * cont,
     sockaddr const* aip,
-    char *hostname, int len = 0
+    const char *hostname, int len = 0
   );
 
   /** Set the application information (fire-and-forget). */
@@ -499,7 +499,7 @@ struct HostDBProcessor: public Processor
   HostDBCache *cache();
   Action *getby(
     Continuation * cont,
-    char *hostname, int len,
+    const char *hostname, int len,
     sockaddr const* ip,
     bool aforce_dns, int timeout = 0
   );
@@ -509,7 +509,7 @@ struct HostDBProcessor: public Processor
       type IPv4.
    */
   void setby(
-    char *hostname, ///< Hostname.
+    const char *hostname, ///< Hostname.
     int len, ///< Length of hostname.
     sockaddr const* aip, ///< Address and/or port.
     HostDBApplicationInfo * app ///< I don't know.

Modified: trafficserver/traffic/trunk/iocore/hostdb/P_HostDB.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/hostdb/P_HostDB.h?rev=1228303&r1=1228302&r2=1228303&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/hostdb/P_HostDB.h (original)
+++ trafficserver/traffic/trunk/iocore/hostdb/P_HostDB.h Fri Jan  6 17:50:27 2012
@@ -59,8 +59,8 @@
                                     HOSTDB_MODULE_MINOR_VERSION, \
                                     PRIVATE_MODULE_HEADER)
 HostDBInfo *probe(ProxyMutex * mutex,
-                  INK_MD5 & md5, char *hostname, int len,
+                  INK_MD5 & md5, const char *hostname, int len,
                   sockaddr const* addr, void *pDS, bool ignore_timeout = false, bool is_srv_lookup
= false);
 
-void make_md5(INK_MD5 & md5, char *hostname, int len, int port, char *pDNSServers = 0,
int srv = 0);
+void make_md5(INK_MD5 & md5, const char *hostname, int len, int port, char *pDNSServers
= 0, int srv = 0);
 #endif

Modified: trafficserver/traffic/trunk/iocore/hostdb/P_HostDBProcessor.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/hostdb/P_HostDBProcessor.h?rev=1228303&r1=1228302&r2=1228303&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/hostdb/P_HostDBProcessor.h (original)
+++ trafficserver/traffic/trunk/iocore/hostdb/P_HostDBProcessor.h Fri Jan  6 17:50:27 2012
@@ -350,7 +350,7 @@ struct HostDBContinuation: public Contin
 
   HostDBInfo *insert(unsigned int attl);
 
-  void init(char *hostname, int len, sockaddr const* ip, INK_MD5 & amd5,
+  void init(const char *hostname, int len, sockaddr const* ip, INK_MD5 & amd5,
             Continuation * cont, void *pDS = 0, bool is_srv = false, int timeout = 0);
   int make_get_message(char *buf, int len);
   int make_put_message(HostDBInfo * r, Continuation * c, char *buf, int len);
@@ -408,7 +408,7 @@ master_hash(INK_MD5 & md5)
 }
 
 inline bool
-is_dotted_form_hostname(char *c)
+is_dotted_form_hostname(const char *c)
 {
   return -1 != (int) ink_inet_addr(c);
 }

Modified: trafficserver/traffic/trunk/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=1228303&r1=1228302&r2=1228303&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPI.cc Fri Jan  6 17:50:27 2012
@@ -6327,7 +6327,7 @@ TSNetAccept(TSCont contp, int port, int 
 
 /* DNS Lookups */
 TSAction
-TSHostLookup(TSCont contp, char *hostname, int namelen)
+TSHostLookup(TSCont contp, const char *hostname, size_t namelen)
 {
   sdk_assert(sdk_sanity_check_continuation(contp) == TS_SUCCESS);
   sdk_assert(sdk_sanity_check_null_ptr((void*)hostname) == TS_SUCCESS);

Modified: trafficserver/traffic/trunk/proxy/api/ts/ts.h.in
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/ts.h.in?rev=1228303&r1=1228302&r2=1228303&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/ts.h.in (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/ts.h.in Fri Jan  6 17:50:27 2012
@@ -2460,7 +2460,7 @@ extern "C"
 
   /* --------------------------------------------------------------------------
      DNS Lookups */
-  tsapi TSAction TSHostLookup(TSCont contp, char* hostname, int namelen);
+  tsapi TSAction TSHostLookup(TSCont contp, const char* hostname, size_t namelen);
   /**  @deprecated Use TSHostLookupResultAddrGet */
   tsapi TS_DEPRECATED unsigned int TSHostLookupResultIPGet(TSHostLookupResult lookup_result);
   tsapi struct sockaddr const* TSHostLookupResultAddrGet(TSHostLookupResult lookup_result);



Mime
View raw message