[pisa-src] r1711 - in trunk: libpisa/conmgr.c libpisa/conmgr.h pisacd/cdconfhandlers.c pisacd/cdderegister.c pisacd/cdheartbeat.c pisacd/cdregister.c pisacd/cdservers.c pisacd/cdtun.c pisasd/sdderegister.c pi...

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Thu, 19 Nov 2009 14:51:57 +0100

Author: tjansen
Date: Thu Nov 19 14:51:57 2009
New Revision: 1711

Log:
Renamed function pisa_conmgr_findby_address to pisa_conmgr_findby_hit.

The function name was ambiguous. In ancient times, this function used to have
a struct sockaddr_in6 * as a parameter. We since switched to struct in6_addr *.
The new name should be less confusing.

Modified:
   trunk/libpisa/conmgr.c
   trunk/libpisa/conmgr.h
   trunk/pisacd/cdconfhandlers.c
   trunk/pisacd/cdderegister.c
   trunk/pisacd/cdheartbeat.c
   trunk/pisacd/cdregister.c
   trunk/pisacd/cdservers.c
   trunk/pisacd/cdtun.c
   trunk/pisasd/sdderegister.c
   trunk/pisasd/sdheartbeat.c
   trunk/pisasd/sdregister.c
   trunk/pisasd/sdtun.c

Modified: trunk/libpisa/conmgr.c
==============================================================================
--- trunk/libpisa/conmgr.c      Thu Nov 19 14:47:51 2009        (r1710)
+++ trunk/libpisa/conmgr.c      Thu Nov 19 14:51:57 2009        (r1711)
@@ -151,7 +151,7 @@
  * @param addr the hit we want to find the associated socket for
  * @return the association or NULL, if none is found
  */
-pisa_conmgr_entry* pisa_conmgr_findby_address(pisa_conmgr_list *conlist, const 
struct in6_addr *addr)
+pisa_conmgr_entry* pisa_conmgr_findby_hit(pisa_conmgr_list *conlist, const 
struct in6_addr *addr)
 {
        pisa_conmgr_entry* ret = NULL;
        HASH_FIND(hh, conlist->hash_ipv6, addr, sizeof(struct in6_addr), ret);

Modified: trunk/libpisa/conmgr.h
==============================================================================
--- trunk/libpisa/conmgr.h      Thu Nov 19 14:47:51 2009        (r1710)
+++ trunk/libpisa/conmgr.h      Thu Nov 19 14:51:57 2009        (r1711)
@@ -123,7 +123,7 @@
 void pisa_conmgr_connected(pisa_conmgr_list *conlist, pisa_conmgr_entry* 
entry, unsigned short data_port, struct in_addr *client_ipv4);
 void pisa_conmgr_remove(pisa_conmgr_list *conlist, struct pisa_nat_list 
*natlist, pisa_conmgr_entry* entry);
 
-pisa_conmgr_entry* pisa_conmgr_findby_address(pisa_conmgr_list *conlist, const 
struct in6_addr* addr);
+pisa_conmgr_entry* pisa_conmgr_findby_hit(pisa_conmgr_list *conlist, const 
struct in6_addr* addr);
 pisa_conmgr_entry* pisa_conmgr_findby_clientip(pisa_conmgr_list *conlist, 
const struct in_addr *client_ipv4);
 
 void pisa_conmgr_iterate(pisa_conmgr_list *conlist, conmgr_callback cb, void* 
data);

Modified: trunk/pisacd/cdconfhandlers.c
==============================================================================
--- trunk/pisacd/cdconfhandlers.c       Thu Nov 19 14:47:51 2009        (r1710)
+++ trunk/pisacd/cdconfhandlers.c       Thu Nov 19 14:51:57 2009        (r1711)
@@ -56,7 +56,7 @@
        assert(packet);
        serviceadd = &packet->body.request.rdata.serviceadd;
 
-       if ((entry = pisa_conmgr_findby_address(cd_ctx.conlist, 
&serviceadd->hit)) == NULL) {
+       if ((entry = pisa_conmgr_findby_hit(cd_ctx.conlist, &serviceadd->hit)) 
== NULL) {
                PISA_ERROR("Request to add a service with nonexisting server 
HIT.\n");
                return;
        }

Modified: trunk/pisacd/cdderegister.c
==============================================================================
--- trunk/pisacd/cdderegister.c Thu Nov 19 14:47:51 2009        (r1710)
+++ trunk/pisacd/cdderegister.c Thu Nov 19 14:51:57 2009        (r1711)
@@ -130,7 +130,7 @@
 void pisa_recv_deregister_ack(UNUSED pisa_packet *pkt, struct sockaddr_in6 
*addr)
 {
        char buffer[INET6_ADDRSTRLEN];
-       pisa_conmgr_entry *entry = pisa_conmgr_findby_address(cd_ctx.conlist, 
&addr->sin6_addr);
+       pisa_conmgr_entry *entry = pisa_conmgr_findby_hit(cd_ctx.conlist, 
&addr->sin6_addr);
        pisa_pending *pend;
 
        if (entry == NULL)

Modified: trunk/pisacd/cdheartbeat.c
==============================================================================
--- trunk/pisacd/cdheartbeat.c  Thu Nov 19 14:47:51 2009        (r1710)
+++ trunk/pisacd/cdheartbeat.c  Thu Nov 19 14:51:57 2009        (r1711)
@@ -26,7 +26,7 @@
 void pisa_recv_heartbeat_ack(UNUSED pisa_packet *pkt, struct sockaddr_in6 
*addr)
 {
        char buffer[INET6_ADDRSTRLEN];
-       pisa_conmgr_entry *entry = pisa_conmgr_findby_address(cd_ctx.conlist, 
&addr->sin6_addr);
+       pisa_conmgr_entry *entry = pisa_conmgr_findby_hit(cd_ctx.conlist, 
&addr->sin6_addr);
        pisa_pending *pend;
 
        if (entry == NULL)
@@ -80,7 +80,7 @@
        inet_ntop(AF_INET6, &pend->key.addr.sin6_addr, buffer, sizeof(buffer));
        if (pend->entry->status == PISA_CON_CONNECTED) {
                PISA_INFO("HEARTBEAT to %s failed, disconnecting\n", buffer);
-               pisa_client_disconnect_from_server(NULL, 
pisa_conmgr_findby_address(cd_ctx.conlist, &pend->key.addr.sin6_addr));
+               pisa_client_disconnect_from_server(NULL, 
pisa_conmgr_findby_hit(cd_ctx.conlist, &pend->key.addr.sin6_addr));
        } else {
                PISA_DEBUG(PL_HEARTBEAT, "HEARTBEAT to %s failed, wrong 
status\n", buffer);
        }

Modified: trunk/pisacd/cdregister.c
==============================================================================
--- trunk/pisacd/cdregister.c   Thu Nov 19 14:47:51 2009        (r1710)
+++ trunk/pisacd/cdregister.c   Thu Nov 19 14:51:57 2009        (r1711)
@@ -134,7 +134,7 @@
        pisa_conmgr_entry *entry;
        struct timeval delay;
 
-       entry = pisa_conmgr_findby_address(cd_ctx.conlist, &addr->sin6_addr);
+       entry = pisa_conmgr_findby_hit(cd_ctx.conlist, &addr->sin6_addr);
        if (entry == NULL) {
                PISA_DEBUG(PL_STATEMACHINE, "Received REGISTER_ACK from unknown 
connection, ignoring it.\n");
                return;

Modified: trunk/pisacd/cdservers.c
==============================================================================
--- trunk/pisacd/cdservers.c    Thu Nov 19 14:47:51 2009        (r1710)
+++ trunk/pisacd/cdservers.c    Thu Nov 19 14:51:57 2009        (r1711)
@@ -234,7 +234,7 @@
        inet_pton(AF_INET6, "2001:16:415e:da37:11f6:d0e7:33f5:3ee7", &hit);
        inet_pton(AF_INET, "192.168.151.31", &remote);
 
-       entry = pisa_conmgr_findby_address(cd_ctx.conlist, &hit);
+       entry = pisa_conmgr_findby_hit(cd_ctx.conlist, &hit);
 
        pisa_nat_upgrade_preliminary(cd_ctx.natlist, nat, &remote, entry, NULL);
 

Modified: trunk/pisacd/cdtun.c
==============================================================================
--- trunk/pisacd/cdtun.c        Thu Nov 19 14:47:51 2009        (r1710)
+++ trunk/pisacd/cdtun.c        Thu Nov 19 14:51:57 2009        (r1711)
@@ -50,7 +50,7 @@
        }
 
        /* Check if we have an active connection with the origin */
-       entry = pisa_conmgr_findby_address(cd_ctx.conlist, &from.sin6_addr);
+       entry = pisa_conmgr_findby_hit(cd_ctx.conlist, &from.sin6_addr);
        if (entry != NULL) {
                if (entry->status != PISA_CON_CONNECTED) {
                        PISA_DEBUG(PL_DATA, "Discarding data from a server that 
is not in CONNECTED state!\n");

Modified: trunk/pisasd/sdderegister.c
==============================================================================
--- trunk/pisasd/sdderegister.c Thu Nov 19 14:47:51 2009        (r1710)
+++ trunk/pisasd/sdderegister.c Thu Nov 19 14:51:57 2009        (r1711)
@@ -25,7 +25,7 @@
 void pisa_recv_deregister(UNUSED pisa_packet *pkt, struct sockaddr_in6 *addr)
 {
        char buffer[INET6_ADDRSTRLEN];
-       pisa_conmgr_entry *e = pisa_conmgr_findby_address(sd_ctx.conlist, 
&addr->sin6_addr);
+       pisa_conmgr_entry *e = pisa_conmgr_findby_hit(sd_ctx.conlist, 
&addr->sin6_addr);
 
        inet_ntop(AF_INET6, &addr->sin6_addr, buffer, sizeof(buffer));
 

Modified: trunk/pisasd/sdheartbeat.c
==============================================================================
--- trunk/pisasd/sdheartbeat.c  Thu Nov 19 14:47:51 2009        (r1710)
+++ trunk/pisasd/sdheartbeat.c  Thu Nov 19 14:51:57 2009        (r1711)
@@ -52,7 +52,7 @@
 void pisa_recv_heartbeat(UNUSED pisa_packet *pkt, struct sockaddr_in6 *addr)
 {
        char buffer[INET6_ADDRSTRLEN];
-       pisa_conmgr_entry *e = pisa_conmgr_findby_address(sd_ctx.conlist, 
&addr->sin6_addr);
+       pisa_conmgr_entry *e = pisa_conmgr_findby_hit(sd_ctx.conlist, 
&addr->sin6_addr);
 
        if (e) {
                e->heartbeat_flag = 1;

Modified: trunk/pisasd/sdregister.c
==============================================================================
--- trunk/pisasd/sdregister.c   Thu Nov 19 14:47:51 2009        (r1710)
+++ trunk/pisasd/sdregister.c   Thu Nov 19 14:51:57 2009        (r1711)
@@ -139,7 +139,7 @@
 void pisa_recv_register(pisa_packet *pkt, struct sockaddr_in6 *addr)
 {
        char buffer[INET6_ADDRSTRLEN];
-       pisa_conmgr_entry *e = pisa_conmgr_findby_address(sd_ctx.conlist, 
&addr->sin6_addr);
+       pisa_conmgr_entry *e = pisa_conmgr_findby_hit(sd_ctx.conlist, 
&addr->sin6_addr);
 
        if (e!=NULL) {
                inet_ntop(AF_INET6, &addr->sin6_addr, buffer, sizeof(buffer));

Modified: trunk/pisasd/sdtun.c
==============================================================================
--- trunk/pisasd/sdtun.c        Thu Nov 19 14:47:51 2009        (r1710)
+++ trunk/pisasd/sdtun.c        Thu Nov 19 14:51:57 2009        (r1711)
@@ -58,7 +58,7 @@
        }
 
        /* Check if we have an active connection with the origin */
-       if ((entry = pisa_conmgr_findby_address(sd_ctx.conlist, 
&from.sin6_addr)) != NULL) {
+       if ((entry = pisa_conmgr_findby_hit(sd_ctx.conlist, &from.sin6_addr)) 
!= NULL) {
                if (entry->status != PISA_CON_CONNECTED) {
                        PISA_DEBUG(PL_STATEMACHINE, "Connection exists, but is 
not in CONNECTED state. Should not be possible!\n");
                        return;

Other related posts:

  • » [pisa-src] r1711 - in trunk: libpisa/conmgr.c libpisa/conmgr.h pisacd/cdconfhandlers.c pisacd/cdderegister.c pisacd/cdheartbeat.c pisacd/cdregister.c pisacd/cdservers.c pisacd/cdtun.c pisasd/sdderegister.c pi... - Thomas Jansen