Author: tjansen Date: Wed Oct 21 13:22:45 2009 New Revision: 1253 Log: Removed deprecated preauth code from conmgr. Modified: trunk/include/conmgr.h trunk/libpisa/conmgr.c Modified: trunk/include/conmgr.h ============================================================================== --- trunk/include/conmgr.h Wed Oct 21 13:16:11 2009 (r1252) +++ trunk/include/conmgr.h Wed Oct 21 13:22:45 2009 (r1253) @@ -36,19 +36,9 @@ */ typedef struct { -#ifdef REMOVE_PREAUTH_CODE - /** File descriptor of our pseudo tunnel device */ - int fd_pstunc; -#endif /* REMOVE_PREAUTH_CODE */ - /** The IPv4 address used on the client side of the socket. */ struct in_addr ipv4; -#ifdef REMOVE_PREAUTH_CODE - /** Core information of the token verify procedure */ - pisa_vrfyinfo vrfyinfo; -#endif /* REMOVE_PREAUTH_CODE */ - /** Control port of the connection */ int control_port; @@ -88,9 +78,6 @@ /** Hash handles for the different keys. Provided by uthash.h. */ UT_hash_handle hh; -#ifdef REMOVE_PREAUTH_CODE - UT_hash_handle hh_pstun; -#endif /* REMOVE_PREAUTH_CODE */ UT_hash_handle hh_ipv4; /** Connection type: e.g. relay, service or legacy-router */ @@ -126,44 +113,23 @@ typedef struct pisa_conmgr_list { pisa_conmgr_entry* hash_ipv6; pisa_conmgr_entry* hash_ipv4; -#ifdef REMOVE_PREAUTH_CODE - pisa_conmgr_entry* hash_pstun; -#endif /* REMOVE_PREAUTH_CODE */ pisa_conmgr_connection_remove_callback connection_remove_callback; } pisa_conmgr_list; struct pisa_nat_list; pisa_conmgr_list *pisa_conmgr_init(pisa_conmgr_connection_remove_callback callback); -#ifdef REMOVE_PREAUTH_CODE -void pisa_conmgr_init_pstun(pisa_conmgr_list *conlist); -#endif /* REMOVE_PREAUTH_CODE */ void pisa_conmgr_cleanup(pisa_conmgr_list **conlist, struct pisa_nat_list *natlist); -#ifdef REMOVE_PREAUTH_CODE -void pisa_conmgr_cleanup_pstun(pisa_conmgr_list **conlist); -#endif /* REMOVE_PREAUTH_CODE */ pisa_conmgr_entry* pisa_conmgr_add(pisa_conmgr_list *conlist, const struct in6_addr* client_addr, int ctrl_port); -#ifdef REMOVE_PREAUTH_CODE -pisa_conmgr_entry* pisa_conmgr_add_pstun(pisa_conmgr_list *conlist, const struct sockaddr_in6* client_addr); -#endif /* REMOVE_PREAUTH_CODE */ 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); -#ifdef REMOVE_PREAUTH_CODE -void pisa_conmgr_remove_pstun(pisa_conmgr_list *conlist, pisa_conmgr_entry* entry); -#endif /* REMOVE_PREAUTH_CODE */ pisa_conmgr_entry* pisa_conmgr_findby_address(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); -#ifdef REMOVE_PREAUTH_CODE -pisa_conmgr_entry* pisa_conmgr_findby_address_pstun(pisa_conmgr_list *conlist, const struct in6_addr* sin6_addr); -#endif /* REMOVE_PREAUTH_CODE */ void pisa_conmgr_iterate(pisa_conmgr_list *conlist, conmgr_callback cb, void* data); void pisa_conmgr_iterate_connected(pisa_conmgr_list *conlist, conmgr_callback cb, void* data); -#ifdef REMOVE_PREAUTH_CODE -void pisa_conmgr_iterate_pstun(pisa_conmgr_list *conlist, conmgr_callback cb, void* data); -#endif /* REMOVE_PREAUTH_CODE */ void pisa_conmgr_build_sockaddr_control(pisa_conmgr_entry* entry, struct sockaddr_in6* addr); void pisa_conmgr_build_sockaddr_data(pisa_conmgr_entry* entry, struct sockaddr_in6* addr); Modified: trunk/libpisa/conmgr.c ============================================================================== --- trunk/libpisa/conmgr.c Wed Oct 21 13:16:11 2009 (r1252) +++ trunk/libpisa/conmgr.c Wed Oct 21 13:22:45 2009 (r1253) @@ -44,20 +44,6 @@ free(entry); } -#ifdef REMOVE_PREAUTH_CODE -/** - * Destructor for pisa_conmgr_entry instances. Every pisa_conmgr_entry - * instance which isn't used any more should be freed with a - * call to this. - * @param entry instance which is to be deleted - */ -static void pisa_conmgr_free_pstun(pisa_conmgr_entry* entry) -{ - close(entry->fd_pstunc); - free(entry); -} -#endif /* REMOVE_PREAUTH_CODE */ - /** * This must be called before any other call to the pisa_conmgr module. * Will initialize internal state and data structurs. @@ -74,19 +60,6 @@ return conlist; } -#ifdef REMOVE_PREAUTH_CODE -/** - * This must be called before any other call to the pisa_conmgr module. - * Will initialize internal state and data structurs. - * The complementary function is pisa_conmgr_cleanup_pstun - * @sa pisa_conmgr_cleanup_pstun - */ -void pisa_conmgr_init_pstun(pisa_conmgr_list *conlist) -{ - assert(conlist->hash_pstun == NULL); -} -#endif /* REMOVE_PREAUTH_CODE */ - /** * Clean up and free all memory occupied by the pisa_conmgr module. * @sa pisa_conmgr_init @@ -99,20 +72,6 @@ *conlist = NULL; } -#ifdef REMOVE_PREAUTH_CODE -/** - * Clean up and free all memory occupied by the pisa_conmgr module. - * @sa pisa_conmgr_init_pstun - */ -void pisa_conmgr_cleanup_pstun(pisa_conmgr_list **conlist) -{ - while ((*conlist)->hash_pstun) - pisa_conmgr_remove_pstun(*conlist, (*conlist)->hash_pstun); - free(*conlist); - *conlist = NULL; -} -#endif /* REMOVE_PREAUTH_CODE */ - /** * Set connection data we get only during connection establishment. * @param entry the connection that will be updated @@ -133,7 +92,6 @@ } } - /** * Add a new association to the pisa_conmgr module. * @param hit IPv6 address to be associated with the socket @@ -160,35 +118,6 @@ return entry; } -#ifdef REMOVE_PREAUTH_CODE -/** - * Add a new association to the pisa_conmgr module. - * @param client_addr IPv4 address to be associated with the socket - * @return pointer to the new assocation - * @sa pisa_conmgr_remove_pstun - * TODO: What is this good for? Mail -> Dongsu - */ -pisa_conmgr_entry* pisa_conmgr_add_pstun(pisa_conmgr_list *conlist, const struct sockaddr_in6* client_addr) -{ -/* @todo fix this function */ - pisa_conmgr_entry* entry = pisa_conmgr_new(); -#if 0 -/* - buildIPs(&entry->serverIpv4address,&entry->clientIpv4address); -*/ - entry->address_control = dubIp6SocketAddress(client_addr); - - time(&entry->timeout_heartbeat); - time(&entry->timeout_client); - entry->status = PISA_CON_DISCONNECTED; - - HASH_ADD_KEYPTR(hh_pstun, conlist->hash_pstun, &client_addr->sin6_addr, - sizeof(struct in6_addr), entry); -#endif - return entry; -} -#endif /* REMOVE_PREAUTH_CODE */ - /** * Remove given entry from internal set of associations * @param entry Pointer to the association to be removed @@ -212,18 +141,6 @@ pisa_conmgr_free(entry); } -#ifdef REMOVE_PREAUTH_CODE -/** - * Remove given entry from internal set of associations - * @param entry Pointer to the association to be removed - */ -void pisa_conmgr_remove_pstun(pisa_conmgr_list *conlist, pisa_conmgr_entry* entry) -{ - HASH_DELETE(hh_pstun, conlist->hash_pstun, entry); - pisa_conmgr_free_pstun(entry); -} -#endif /* REMOVE_PREAUTH_CODE */ - /** * Find the association to a given HIT * @param addr the hit we want to find the associated socket for @@ -248,20 +165,6 @@ return ret; } -#ifdef REMOVE_PREAUTH_CODE -/** - * Find the association to a given HIT - * @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_pstun(pisa_conmgr_list *conlist, const struct in6_addr* sin6_addr) -{ - pisa_conmgr_entry* ret = NULL; - HASH_FIND(hh_pstun, conlist->hash_pstun, sin6_addr, sizeof(struct in6_addr), ret); - return ret; -} -#endif /* REMOVE_PREAUTH_CODE */ - /** * Higher order function: the callback is called for every * element of our internal association list. Data is passed @@ -297,25 +200,6 @@ cb(data, it); } -#ifdef REMOVE_PREAUTH_CODE -/** - * Higher order function: the callback is called for every - * element of our internal association list. Data is passed - * through unaltered to the callback (e.g. to accumulate - * information) - * @param cb Callback function which is called repeatedly - * @param data passed through unaltered to the callback function - * @sa fdCallback - */ -void pisa_conmgr_iterate_pstun(pisa_conmgr_list *conlist, conmgr_callback cb, void* data) -{ - pisa_conmgr_entry* it = NULL; - - for (it = conlist->hash_pstun; it != NULL; it = it->hh_pstun.next) - cb(data, it); -} -#endif /* REMOVE_PREAUTH_CODE */ - /** * Build a sockaddr_in6 address from an entry with a given port. Used by the * higher level pisa_conmgr_build_sockaddr_{control,data} functions.