Classes | |
| struct | SOCKET |
| struct | IP_SOCKET |
| struct | TCP_SOCKET |
| struct | UDP_SOCKET |
| struct | RING_BUFFER |
| struct | STREAM_SOCKET |
| struct | sockaddr |
| struct | socket_queue_entry |
| struct | socket_options |
Macros | |
| #define | socket_init |
| --------------------------------------------------------------—; ; socket_init ; ; --------------------------------------------------------------—; More... | |
Variables | |
| rd | net_sockets |
| dd | last_socket_num |
| dw | last_UDP_port |
| last used ephemeral port More... | |
| dw | last_TCP_port |
| MUTEX | socket_mutex |
| label | sys_socket |
| --------------------------------------------------------------—; ; Sockets API (system function 75) ; ; --------------------------------------------------------------—; More... | |
| label | socket_open |
| --------------------------------------------------------------—; ; socket_open: Create a new socket. ; ; IN: ecx = domain ; edx = type ; esi = protocol ; ; OUT: eax = socket number ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_bind |
| --------------------------------------------------------------—; ; socket_bind: Bind to a local port. ; ; IN: ecx = socket number ; edx = pointer to sockaddr struct ; esi = length of sockaddr struct ; ; OUT: eax = 0 on success ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_connect |
| --------------------------------------------------------------—; ; socket_connect: Connect to the remote host. ; ; IN: ecx = socket number ; edx = pointer to sockaddr struct ; esi = length of sockaddr struct ; ; OUT: eax = 0 on success ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—; More... | |
| label | connect_notsupp |
| label | socket_listen |
| --------------------------------------------------------------—; ; socket_listen: Listen for incoming connections. ; ; IN: ecx = socket number ; edx = backlog in edx ; ; OUT: eax = 0 on success ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_accept |
| --------------------------------------------------------------—; ; socket_accept: Accept an incoming connection. ; ; IN: ecx = socket number (of listening socket) ; edx = ptr to sockaddr struct ; esi = length of sockaddr struct ; ; OUT: eax = newly created socket num ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_close |
| --------------------------------------------------------------—; ; socket_close: Close the socket (and connection). ; ; IN: ecx = socket number ; ; OUT: eax = 0 on success ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_receive |
| --------------------------------------------------------------—; ; socket_receive: Receive some data from the remote end. ; ; IN: ecx = socket number ; edx = addr to application buffer ; esi = length of application buffer ; edi = flags ; ; OUT: eax = number of bytes copied ; eax = -1 on error ; eax = 0 when socket has been closed by the remote end ; ebx = errorcode on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_receive_dgram |
| label | socket_receive_tcp |
| label | socket_receive_local |
| label | socket_receive_stream |
| label | socket_send |
| --------------------------------------------------------------—; ; socket_send: Send some data to the remote end. ; ; IN: ecx = socket number ; edx = pointer to data ; esi = data length ; edi = flags ; ; OUT: eax = number of bytes sent ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_send_udp |
| label | socket_send_tcp |
| label | socket_send_ip |
| label | socket_send_icmp |
| label | socket_send_local |
| label | socket_send_local_initialized |
| label | socket_get_opt |
| --------------------------------------------------------------—; ; socket_get_opt: Read a socket option ; ; IN: ecx = socket number ; edx = pointer to socket options struct ; ; OUT: eax = 0 on success ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_set_opt |
| --------------------------------------------------------------—; ; socket_set_options: Set a socket option. ; ; IN: ecx = socket number ; edx = pointer to socket options struct ; ; OUT: eax = 0 on success ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_pair |
| --------------------------------------------------------------—; ; socket_pair: Allocate a pair of linked local sockets. ; ; IN: / ; ; OUT: eax = socket1 num on success ; eax = -1 on error ; ebx = socket2 num on success ; ebx = errorcode on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_debug |
| --------------------------------------------------------------—; ; socket_debug: Copy socket variables to application buffer. ; ; IN: ecx = socket number ; edx = pointer to application buffer ; ; OUT: eax = 0 on success ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_find_port |
| --------------------------------------------------------------—; ; socket_find_port: ; Fill in the local port number for TCP and UDP sockets ; This procedure always works because the number of sockets is ; limited to a smaller number then the number of possible ports ; ; IN: eax = socket pointer ; ; OUT: / ; ; --------------------------------------------------------------—; More... | |
| label | socket_check_port |
| --------------------------------------------------------------—; ; socket_check_port: (to be used with AF_INET only!) ; Checks if a local port number is unused ; If the proposed port number is unused, it is filled in in the ; socket structure. ; ; IN: eax = socket ptr ; bx = proposed socket number (network byte order) ; ; OUT: ZF = set on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_input |
| --------------------------------------------------------------—; ; socket_input: Update a (stateless) socket with received data. ; ; Note: The socket's mutex should already be set ! ; ; IN: eax = socket ptr ; ecx = data size ; esi = ptr to data ; [esp] = ptr to buf ; ; OUT: / ; ; --------------------------------------------------------------—; More... | |
| label | socket_ring_create |
| --------------------------------------------------------------—; ; socket_ring_create: Create a ringbuffer for sockets. ; ; IN: eax = ptr to ring struct ; ; OUT: eax = 0 on error ; eax = start ptr ; ; --------------------------------------------------------------—; More... | |
| label | socket_ring_write |
| --------------------------------------------------------------—; ; socket_ring_write: Write data to ring buffer. ; ; IN: eax = ptr to ring struct ; ecx = data size ; esi = ptr to data ; ; OUT: ecx = number of bytes stored ; ; --------------------------------------------------------------—; More... | |
| label | socket_ring_read |
| --------------------------------------------------------------—; ; socket_ring_read: Read from ring buffer ; ; IN: eax = ring struct ptr ; ecx = bytes to read ; edx = offset ; edi = ptr to buffer start ; ; OUT: eax = unchanged ; ecx = number of bytes read (0 on error) ; edx = destroyed ; esi = destroyed ; edi = ptr to buffer end ; ; --------------------------------------------------------------—; More... | |
| label | socket_ring_free |
| --------------------------------------------------------------—; ; socket_ring_free: Free data from a ringbuffer. ; ; IN: eax = ptr to ring struct ; ecx = data size ; ; OUT: ecx = number of freed bytes ; ; --------------------------------------------------------------—; More... | |
| label | socket_block |
| --------------------------------------------------------------—; ; socket_block: Suspend the thread attached to a socket. ; ; IN: eax = socket ptr ; ; OUT: eax = unchanged ; ; --------------------------------------------------------------—; More... | |
| label | socket_notify |
| --------------------------------------------------------------—; ; socket_notify: Wake up socket owner thread. ; ; IN: eax = socket ptr ; ; OUT: eax = unchanged ; ; --------------------------------------------------------------—; More... | |
| label | socket_alloc |
| --------------------------------------------------------------—; ; socket_alloc: Allocate memory for socket and put new socket ; into the list. Newly created socket is initialized with calling ; PID and given a socket number. ; ; IN: / ; ; OUT: eax = socket ptr on success ; eax = 0 on error ; edi = socket number on success ; ; --------------------------------------------------------------—; More... | |
| label | socket_free |
| --------------------------------------------------------------—; ; socket_free: Free socket data memory and remove socket from ; the list. Caller should lock and unlock socket_mutex. ; ; IN: eax = socket ptr ; ; OUT: / ; ; --------------------------------------------------------------—; More... | |
| label | socket_fork |
| --------------------------------------------------------------—; ; socket_fork: Create a child socket. ; ; IN: ebx = socket number ; ; OUT: eax = child socket number on success ; eax = 0 on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_num_to_ptr |
| --------------------------------------------------------------—; ; socket_num_to_ptr: Get socket structure address by its number. ; ; IN: ecx = socket number ; ; OUT: eax = socket ptr ; eax = 0 on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_ptr_to_num |
| --------------------------------------------------------------—; ; socket_ptr_to_num: Get socket number by its address. ; ; IN: eax = socket ptr ; ; OUT: eax = socket number ; eax = 0 on error ; ZF = set on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_check |
| --------------------------------------------------------------—; ; socket_check: Checks if the given ptr is really a socket ptr. ; ; IN: eax = socket ptr ; ; OUT: eax = 0 on error ; ZF = set on error ; ; --------------------------------------------------------------—; More... | |
| label | socket_check_owner |
| --------------------------------------------------------------—; ; socket_check_owner: Check if the caller app owns the socket. ; ; IN: eax = socket ptr ; ; OUT: ZF = true/false ; ; --------------------------------------------------------------—; More... | |
| label | socket_process_end |
| --------------------------------------------------------------—; ; socket_process_end: Kernel calls this function when a certain ; process ends. This function will check if the process had any ; open sockets and update them accordingly (clean up). ; ; IN: edx = pid ; ; OUT: / ; ; --------------------------------------------------------------—; More... | |
| label | socket_is_connecting |
| --------------------------------------------------------------—; ; socket_is_connecting: Update socket state. ; ; IN: eax = socket ptr ; ; OUT: / ; ; --------------------------------------------------------------—; More... | |
| label | socket_is_connected |
| --------------------------------------------------------------—; ; socket_is_connected: Update socket state. ; ; IN: eax = socket ptr ; ; OUT: / ; ; --------------------------------------------------------------—; More... | |
| label | socket_is_disconnecting |
| --------------------------------------------------------------—; ; socket_is_disconnecting: Update socket state. ; ; IN: eax = socket ptr ; ; OUT: / ; ; --------------------------------------------------------------—; More... | |
| label | socket_is_disconnected |
| --------------------------------------------------------------—; ; socket_is_disconnected: Update socket state. ; ; IN: eax = socket ptr ; ; OUT: / ; ; --------------------------------------------------------------—; More... | |
| label | socket_cant_recv_more |
| --------------------------------------------------------------—; ; socket_cant_recv_more: Update socket state. ; ; IN: eax = socket ptr ; ; OUT: / ; ; --------------------------------------------------------------—; More... | |
| label | socket_cant_send_more |
| --------------------------------------------------------------—; ; socket_cant_send_more: Update socket state. ; ; IN: eax = socket ptr ; ; OUT: / ; ; --------------------------------------------------------------—; More... | |
| #define socket_init |
--------------------------------------------------------------—; ; socket_init ; ; --------------------------------------------------------------—;
| label connect_notsupp |
| dd last_socket_num |
| dw last_TCP_port |
| dw last_UDP_port |
| rd net_sockets |
| label socket_accept |
--------------------------------------------------------------—; ; socket_accept: Accept an incoming connection. ; ; IN: ecx = socket number (of listening socket) ; edx = ptr to sockaddr struct ; esi = length of sockaddr struct ; ; OUT: eax = newly created socket num ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—;
| label socket_alloc |
--------------------------------------------------------------—; ; socket_alloc: Allocate memory for socket and put new socket ; into the list. Newly created socket is initialized with calling ; PID and given a socket number. ; ; IN: / ; ; OUT: eax = socket ptr on success ; eax = 0 on error ; edi = socket number on success ; ; --------------------------------------------------------------—;
| label socket_bind |
--------------------------------------------------------------—; ; socket_bind: Bind to a local port. ; ; IN: ecx = socket number ; edx = pointer to sockaddr struct ; esi = length of sockaddr struct ; ; OUT: eax = 0 on success ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—;
| label socket_block |
--------------------------------------------------------------—; ; socket_block: Suspend the thread attached to a socket. ; ; IN: eax = socket ptr ; ; OUT: eax = unchanged ; ; --------------------------------------------------------------—;
| label socket_cant_recv_more |
--------------------------------------------------------------—; ; socket_cant_recv_more: Update socket state. ; ; IN: eax = socket ptr ; ; OUT: / ; ; --------------------------------------------------------------—;
| label socket_cant_send_more |
--------------------------------------------------------------—; ; socket_cant_send_more: Update socket state. ; ; IN: eax = socket ptr ; ; OUT: / ; ; --------------------------------------------------------------—;
| label socket_check |
--------------------------------------------------------------—; ; socket_check: Checks if the given ptr is really a socket ptr. ; ; IN: eax = socket ptr ; ; OUT: eax = 0 on error ; ZF = set on error ; ; --------------------------------------------------------------—;
| label socket_check_owner |
--------------------------------------------------------------—; ; socket_check_owner: Check if the caller app owns the socket. ; ; IN: eax = socket ptr ; ; OUT: ZF = true/false ; ; --------------------------------------------------------------—;
| label socket_check_port |
--------------------------------------------------------------—; ; socket_check_port: (to be used with AF_INET only!) ; Checks if a local port number is unused ; If the proposed port number is unused, it is filled in in the ; socket structure. ; ; IN: eax = socket ptr ; bx = proposed socket number (network byte order) ; ; OUT: ZF = set on error ; ; --------------------------------------------------------------—;
| label socket_close |
--------------------------------------------------------------—; ; socket_close: Close the socket (and connection). ; ; IN: ecx = socket number ; ; OUT: eax = 0 on success ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—;
| label socket_connect |
--------------------------------------------------------------—; ; socket_connect: Connect to the remote host. ; ; IN: ecx = socket number ; edx = pointer to sockaddr struct ; esi = length of sockaddr struct ; ; OUT: eax = 0 on success ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—;
| label socket_debug |
--------------------------------------------------------------—; ; socket_debug: Copy socket variables to application buffer. ; ; IN: ecx = socket number ; edx = pointer to application buffer ; ; OUT: eax = 0 on success ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—;
| label socket_find_port |
--------------------------------------------------------------—; ; socket_find_port: ; Fill in the local port number for TCP and UDP sockets ; This procedure always works because the number of sockets is ; limited to a smaller number then the number of possible ports ; ; IN: eax = socket pointer ; ; OUT: / ; ; --------------------------------------------------------------—;
| label socket_fork |
--------------------------------------------------------------—; ; socket_fork: Create a child socket. ; ; IN: ebx = socket number ; ; OUT: eax = child socket number on success ; eax = 0 on error ; ; --------------------------------------------------------------—;
| label socket_free |
--------------------------------------------------------------—; ; socket_free: Free socket data memory and remove socket from ; the list. Caller should lock and unlock socket_mutex. ; ; IN: eax = socket ptr ; ; OUT: / ; ; --------------------------------------------------------------—;
| label socket_get_opt |
--------------------------------------------------------------—; ; socket_get_opt: Read a socket option ; ; IN: ecx = socket number ; edx = pointer to socket options struct ; ; OUT: eax = 0 on success ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—;
| label socket_input |
--------------------------------------------------------------—; ; socket_input: Update a (stateless) socket with received data. ; ; Note: The socket's mutex should already be set ! ; ; IN: eax = socket ptr ; ecx = data size ; esi = ptr to data ; [esp] = ptr to buf ; ; OUT: / ; ; --------------------------------------------------------------—;
| label socket_is_connected |
--------------------------------------------------------------—; ; socket_is_connected: Update socket state. ; ; IN: eax = socket ptr ; ; OUT: / ; ; --------------------------------------------------------------—;
| label socket_is_connecting |
--------------------------------------------------------------—; ; socket_is_connecting: Update socket state. ; ; IN: eax = socket ptr ; ; OUT: / ; ; --------------------------------------------------------------—;
| label socket_is_disconnected |
--------------------------------------------------------------—; ; socket_is_disconnected: Update socket state. ; ; IN: eax = socket ptr ; ; OUT: / ; ; --------------------------------------------------------------—;
| label socket_is_disconnecting |
--------------------------------------------------------------—; ; socket_is_disconnecting: Update socket state. ; ; IN: eax = socket ptr ; ; OUT: / ; ; --------------------------------------------------------------—;
| label socket_listen |
--------------------------------------------------------------—; ; socket_listen: Listen for incoming connections. ; ; IN: ecx = socket number ; edx = backlog in edx ; ; OUT: eax = 0 on success ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—;
| MUTEX socket_mutex |
| label socket_notify |
--------------------------------------------------------------—; ; socket_notify: Wake up socket owner thread. ; ; IN: eax = socket ptr ; ; OUT: eax = unchanged ; ; --------------------------------------------------------------—;
| label socket_num_to_ptr |
--------------------------------------------------------------—; ; socket_num_to_ptr: Get socket structure address by its number. ; ; IN: ecx = socket number ; ; OUT: eax = socket ptr ; eax = 0 on error ; ; --------------------------------------------------------------—;
| label socket_open |
--------------------------------------------------------------—; ; socket_open: Create a new socket. ; ; IN: ecx = domain ; edx = type ; esi = protocol ; ; OUT: eax = socket number ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—;
| label socket_pair |
--------------------------------------------------------------—; ; socket_pair: Allocate a pair of linked local sockets. ; ; IN: / ; ; OUT: eax = socket1 num on success ; eax = -1 on error ; ebx = socket2 num on success ; ebx = errorcode on error ; ; --------------------------------------------------------------—;
| label socket_process_end |
--------------------------------------------------------------—; ; socket_process_end: Kernel calls this function when a certain ; process ends. This function will check if the process had any ; open sockets and update them accordingly (clean up). ; ; IN: edx = pid ; ; OUT: / ; ; --------------------------------------------------------------—;
| label socket_ptr_to_num |
--------------------------------------------------------------—; ; socket_ptr_to_num: Get socket number by its address. ; ; IN: eax = socket ptr ; ; OUT: eax = socket number ; eax = 0 on error ; ZF = set on error ; ; --------------------------------------------------------------—;
| label socket_receive |
--------------------------------------------------------------—; ; socket_receive: Receive some data from the remote end. ; ; IN: ecx = socket number ; edx = addr to application buffer ; esi = length of application buffer ; edi = flags ; ; OUT: eax = number of bytes copied ; eax = -1 on error ; eax = 0 when socket has been closed by the remote end ; ebx = errorcode on error ; ; --------------------------------------------------------------—;
| label socket_receive_dgram |
| label socket_receive_local |
| label socket_receive_stream |
| label socket_receive_tcp |
| label socket_ring_create |
--------------------------------------------------------------—; ; socket_ring_create: Create a ringbuffer for sockets. ; ; IN: eax = ptr to ring struct ; ; OUT: eax = 0 on error ; eax = start ptr ; ; --------------------------------------------------------------—;
| label socket_ring_free |
--------------------------------------------------------------—; ; socket_ring_free: Free data from a ringbuffer. ; ; IN: eax = ptr to ring struct ; ecx = data size ; ; OUT: ecx = number of freed bytes ; ; --------------------------------------------------------------—;
| label socket_ring_read |
--------------------------------------------------------------—; ; socket_ring_read: Read from ring buffer ; ; IN: eax = ring struct ptr ; ecx = bytes to read ; edx = offset ; edi = ptr to buffer start ; ; OUT: eax = unchanged ; ecx = number of bytes read (0 on error) ; edx = destroyed ; esi = destroyed ; edi = ptr to buffer end ; ; --------------------------------------------------------------—;
| label socket_ring_write |
--------------------------------------------------------------—; ; socket_ring_write: Write data to ring buffer. ; ; IN: eax = ptr to ring struct ; ecx = data size ; esi = ptr to data ; ; OUT: ecx = number of bytes stored ; ; --------------------------------------------------------------—;
| label socket_send |
--------------------------------------------------------------—; ; socket_send: Send some data to the remote end. ; ; IN: ecx = socket number ; edx = pointer to data ; esi = data length ; edi = flags ; ; OUT: eax = number of bytes sent ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—;
| label socket_send_icmp |
| label socket_send_ip |
| label socket_send_local |
| label socket_send_local_initialized |
| label socket_send_tcp |
| label socket_send_udp |
| label socket_set_opt |
--------------------------------------------------------------—; ; socket_set_options: Set a socket option. ; ; IN: ecx = socket number ; edx = pointer to socket options struct ; ; OUT: eax = 0 on success ; eax = -1 on error ; ebx = errorcode on error ; ; --------------------------------------------------------------—;
| label sys_socket |
--------------------------------------------------------------—; ; Sockets API (system function 75) ; ; --------------------------------------------------------------—;