#include "helperdef.h"
#include "list.h"
Go to the source code of this file.
Data Structures | |
struct | connlist_item |
structure for a single connection node More... | |
struct | connlist |
structure for the connlist_t type More... | |
Typedefs | |
typedef connlist_item | connlist_item_t |
typedef for the connlist_item structure | |
typedef connlist | connlist_t |
typedef for the connlist structure | |
Functions | |
errorcode | connlist_init (connlist_t *list) |
the function to initialize the list | |
errorcode | connlist_add (connlist_t *list, connlist_item_t *item) |
the function to add an item to the list | |
errorcode | connlist_find (connlist_t *list, int(*func)(void *, void *), void *arg, connlist_item_t **found_item) |
finds an item in the list | |
int | connlist_find_pred_port (void *this_item, void *find_item) |
the function to find a predictied port match (used as a match function for the list implementation). | |
int | connlist_find_buddy (void *this_item, void *find_item) |
the function to find a buddy match (used as a match function for the list implementation). | |
errorcode | connlist_forget (connlist_t *list, int(*func)(void *, void *), connlist_item_t *item) |
the function to remove an item from the list | |
int | connlist_item_match (void *this_item, void *find_item) |
the matching function for an item in the list | |
int | connlist_count (connlist_t *list) |
gets the number of items in the list | |
Variables | |
connlist_item | packed |
structure for a single connection node |
These functions are wrappers for the list.h functions. They provide abstraction and thread-safety
Definition in file connlist.h.
|
the function to add an item to the list This function is thread safe. forget must be called once for this function to remove the item from the list once it has been added.
Definition at line 49 of file connlist.c. References CHECK_NOT_NULL, connlist_item_t, connlist_t, DBG_THREAD, DEBUG, ERROR_NULL_ARG_1, ERROR_NULL_ARG_2, errorcode, FAILED, connlist::list, list_add(), connlist::mutex, and connlist_item::watchers. Referenced by helper_fsm_start(). |
|
gets the number of items in the list This function is thread safe
Definition at line 238 of file connlist.c. References CHECK_NOT_NULL, connlist_t, DBG_THREAD, DEBUG, connlist::list, list_count(), and connlist::mutex. Referenced by natblaster_server(). |
|
finds an item in the list This function is thread safe
Definition at line 79 of file connlist.c. References CHECK_NOT_NULL, connlist_item_t, connlist_t, DBG_PORT_PRED, DBG_THREAD, DEBUG, ERROR_NULL_ARG_1, ERROR_NULL_ARG_2, ERROR_NULL_ARG_4, errorcode, FAILED, connlist::list, list_find(), connlist::mutex, and connlist_item::watchers. Referenced by find_conn2(), and get_buddy(). |
|
the function to find a buddy match (used as a match function for the list implementation).
Definition at line 151 of file connlist.c. References buddy_info_t, CHECK_NOT_NULL, connlist_item_t, buddy_info::ext_ip, connlist_item::info, buddy_info::int_ip, buddy_info::int_port, observed_data::ip, peer_info::ip, LIST_FATAL, connlist_item::obs_data, helper_conn_info::peer, and peer_info::port. Referenced by get_buddy(). |
|
the function to find a predictied port match (used as a match function for the list implementation).
Definition at line 121 of file connlist.c. References CHECK_NOT_NULL, connlist_item_t, DBG_IP, DBG_PORT, DBG_PORT_PRED, DEBUG, observed_data::ip, LIST_FATAL, connlist_item::obs_data, observed_data_t, and observed_data::port. Referenced by find_conn2(). |
|
the function to remove an item from the list This function is thread safe. This function will only remove the item if there are no watchers left. It must be called exactly once for each time find is called, plus once more for the add call.
Definition at line 187 of file connlist.c. References CHECK_NOT_NULL, connlist_item_t, connlist_t, DBG_THREAD, DEBUG, ERROR_NULL_ARG_1, ERROR_NULL_ARG_2, errorcode, FAILED, connlist::list, list_remove(), connlist::mutex, and connlist_item::watchers. Referenced by helper_fsm_buddy_alloc(), helper_fsm_conn2(), and helper_fsm_start(). |
|
the function to initialize the list man page says return value is always 0, but I don't trust it, since the man page for pthreads also says some functions/macros exist that in fact do not. Definition at line 32 of file connlist.c. References CHECK_FAILED, CHECK_NOT_NULL, connlist_t, ERROR_INIT, ERROR_NULL_ARG_1, errorcode, connlist::list, list_init(), and connlist::mutex. Referenced by natblaster_server(). |
|
the matching function for an item in the list
Definition at line 223 of file connlist.c. References CHECK_NOT_NULL, and LIST_FATAL. Referenced by helper_fsm_buddy_alloc(), helper_fsm_conn2(), and helper_fsm_start(). |