static inline void udps_close(TCPIPS* tcpips, HANDLE handle) { UDP_HANDLE* uh; if ((uh = so_get(&tcpips->udps.handles, handle)) == NULL) return; udps_flush(tcpips, handle); so_free(&tcpips->udps.handles, handle); }
void udps_link_changed(TCPIPS* tcpips, bool link) { HANDLE handle; if (link) tcpips->udps.dynamic = TCPIP_DYNAMIC_RANGE_LO; else { while ((handle = so_first(&tcpips->udps.handles)) != INVALID_HANDLE) { udps_flush(tcpips, handle); so_free(&tcpips->udps.handles, handle); } } }
GPrivate void gcmon_souter_free() { so_free(gpSouter); }
HANDLE web_node_allocate(WEB_NODE* web_node, HANDLE parent_handle, char* name, unsigned int flags) { WEB_NODE_ITEM* parent; WEB_NODE_ITEM* cur; WEB_NODE_ITEM* child; HANDLE cur_handle; unsigned int len; len = strlen(name); if (parent_handle == WEB_ROOT_NODE) { if (web_node->root != INVALID_HANDLE) { error(ERROR_ALREADY_CONFIGURED); return INVALID_HANDLE; } } else { parent = so_get(&web_node->items, parent_handle); if (parent == NULL) return INVALID_HANDLE; if (web_node_find_child(web_node, parent, name, len) != NULL) { error(ERROR_ALREADY_CONFIGURED); return INVALID_HANDLE; } } if ((cur_handle = so_allocate(&web_node->items)) == INVALID_HANDLE) return INVALID_HANDLE; cur = so_get(&web_node->items, cur_handle); if ((cur->name = malloc(len + 1)) == NULL) { so_free(&web_node->items, cur_handle); return INVALID_HANDLE; } strcpy(cur->name, name); cur->self = cur_handle; cur->next = cur->child = INVALID_HANDLE; cur->flags = flags; if (parent_handle == WEB_ROOT_NODE) web_node->root = cur_handle; else { //re-fetch after allocate parent = so_get(&web_node->items, parent_handle); //first child if (parent->child == INVALID_HANDLE) parent->child = cur_handle; //add sibling else { for(child = so_get(&web_node->items, parent->child); child->next != INVALID_HANDLE; child = so_get(&web_node->items, child->next)) {} child->next = cur_handle; } } return cur_handle; }
static void web_node_free_internal(WEB_NODE* web_node, WEB_NODE_ITEM* cur) { free(cur->name); so_free(&web_node->items, cur->self); }