12 enum sock_bind_state {
17 /* socket management structure */
20 struct sockaddr_sw addr;
21 enum sock_rw_state rw_state;
22 enum sock_bind_state bind_state;
23 struct sock_list *next;
24 struct sock_list *prev;
27 static struct sock_list sock_list_head = {
28 .next = &sock_list_head,
29 .prev = &sock_list_head
33 * Add new socket to list. Called by sw_socket "syscall".
35 struct sock_list *list_add_socket(int s);
38 * Bind socket to given address. Called by sw_bind "syscall".
41 struct sock_list *list_update_socket_address(int s, __CONST_SOCKADDR_ARG addr);
44 * Get list element containing socket s. Called by sw_send* "syscalls".
47 struct sock_list *list_elem_from_socket(int s);
50 * Get list element containing address addr. Called by sw_bind "syscall".
53 struct sock_list *list_elem_from_address(__CONST_SOCKADDR_ARG addr);
56 * Remove socket from list. Called by sw_close "syscall".
59 int list_remove_socket(int s);
62 * Check if a socket is bound.
64 int list_socket_is_bound(int s);