Go to the source code of this file.
Functions | |
int | check_connect (char *hostname, int port, int protocol) |
Test INET Socket connection to host on port with the specified socket protocol type. | |
int | check_host (char *hostname) |
Check if the hostname resolves. | |
int | check_connection_io (Port_T p) |
Verify that the socket connection is ready for i|o. | |
int | check_socket (int socket) |
Verify that the socket is ready for i|o. | |
int | check_udp_socket (int socket) |
Verify that the udp socket is ready for i|o. | |
int | create_socket (char *hostname, int port, int protocol) |
Open a socket against hostname:port with the given protocol. | |
int | create_generic_socket (Port_T pp) |
Open a socket with given Port_T structure The protocol, destination and type are selected appropriately. | |
int | create_unix_socket (char *pathname, int protocol) |
Open a socket against pathname with the given protocol. | |
int | create_server_socket (int port, int backlog, char *bindAddr) |
Creates a server socket (SOCK_STREAM type) and binds it to the specified local port number, with the specified backlog. | |
int | close_socket (int socket) |
Shutdown a socket and close the descriptor. | |
int | set_sotimeout (int socket, int timeout) |
Set a so_timeout (read/write) for the given socket with the specified timeout in seconds. | |
int | set_noblock (int socket) |
Enable nonblocking i|o on the given socket. | |
int | set_block (int socket) |
Disable nonblocking i|o on the given socket. | |
int | port_send (Port_T p, const char *msg, int len, int flags) |
Send the message 'msg' down a port in non-blocking mode and with failover. | |
int | port_recv (Port_T p, char *buf, int len, int flags) |
Read a message from the socket in non-blocking mode and with failover. | |
int | sock_send (int sock, const char *msg, int len, int flags) |
Send the message 'msg' down the socket in non-blocking mode and with failover. | |
int | sock_recv (int sock, char *buf, int len, int flags) |
Read a message from the socket in non-blocking mode and with failover. | |
char * | get_localhostname () |
Get the local host name. | |
char * | get_remote_host (int socket) |
Get the remote host name from the originating host. |
Definition in file net.c.
|
Test INET Socket connection to host on port with the specified socket protocol type. The protocol is normaly either SOCK_STREAM or SOCK_DGRAM.
Definition at line 112 of file net.c. References ASSERT, check_socket(), close_socket(), and create_socket(). Referenced by check_httpd(). |
|
Verify that the socket connection is ready for i|o. This test use select for a stream based socket. For a dgram sockets the testing technique is to send a 0 byte udp packet and "check" for an ICMP error.
Definition at line 166 of file net.c. References ASSERT, check_socket(), check_udp_socket(), myport::socket, and myport::type. |
|
Check if the hostname resolves.
Definition at line 141 of file net.c. References ASSERT. |
|
Verify that the socket is ready for i|o.
Definition at line 186 of file net.c. References SELECT_TIMEOUT. Referenced by check_connect(), check_connection_io(), and start_httpd(). |
|
Verify that the udp socket is ready for i|o. The given socket must be a connected udp socket. The test is conducted by sending one byte to the server and check for any returned ICMP error when reading from the socket. A better test would be to send an empty udp package to avoid possibly raising an error from the server we are testing.
Definition at line 212 of file net.c. References set_block(), and set_noblock(). Referenced by check_connection_io(). |
|
Shutdown a socket and close the descriptor.
Definition at line 411 of file net.c. Referenced by check_connect(), create_socket(), create_unix_socket(), d_check_process(), destroy_wrapper(), and stop_httpd(). |
|
Open a socket with given Port_T structure The protocol, destination and type are selected appropriately.
Definition at line 288 of file net.c. References ASSERT, create_socket(), create_unix_socket(), myport::family, myport::hostname, myport::pathname, myport::port, and myport::type. |
|
Creates a server socket (SOCK_STREAM type) and binds it to the specified local port number, with the specified backlog. Set a socket option to make the port reusable again. This is useful if the server has been shut down, and then restarted right away while sockets are still active on its port. If a bind address is given the socket will only accept connect requests to this addresses. If the bind address is NULL it will default accepting connections on any/all local addresses
Definition at line 358 of file net.c. Referenced by create_ssl_server_socket(), and start_httpd(). |
|
Open a socket against hostname:port with the given protocol. The protocol is normaly either SOCK_STREAM or SOCK_DGRAM.
Definition at line 246 of file net.c. References ASSERT, and close_socket(). Referenced by check_connect(), create_generic_socket(), create_ssl_socket(), and d_check_process(). |
|
Open a socket against pathname with the given protocol. The protocol is normaly either SOCK_STREAM or SOCK_DGRAM.
Definition at line 316 of file net.c. References ASSERT, and close_socket(). Referenced by create_generic_socket(). |
|
Get the local host name.
Definition at line 658 of file net.c. Referenced by sendmail(). |
|
Get the remote host name from the originating host.
|
|
Read a message from the socket in non-blocking mode and with failover. Uses SSL if necessary.
Definition at line 511 of file net.c. References ASSERT, len, recv_ssl_socket(), sock_recv(), myport::socket, and myport::ssl. Referenced by check_ftp(), check_http(), check_imap(), check_nntp(), check_pop(), check_smtp(), and check_ssh(). |
|
Send the message 'msg' down a port in non-blocking mode and with failover. Uses SSL if necessary.
Definition at line 485 of file net.c. References ASSERT, len, send_ssl_socket(), sock_send(), myport::socket, and myport::ssl. Referenced by check_ftp(), check_http(), check_imap(), check_nntp(), check_pop(), check_smtp(), and check_ssh(). |
|
Disable nonblocking i|o on the given socket.
Definition at line 468 of file net.c. Referenced by check_udp_socket(), sock_recv(), and sock_send(). |
|
Enable nonblocking i|o on the given socket.
Definition at line 454 of file net.c. Referenced by check_udp_socket(), embed_accepted_ssl_socket(), embed_ssl_socket(), sock_recv(), and sock_send(). |
|
Set a so_timeout (read/write) for the given socket with the specified timeout in seconds.
|
|
Read a message from the socket in non-blocking mode and with failover. Inspired by code from the Apache web server.
Definition at line 607 of file net.c. References ASSERT, len, SELECT_TIMEOUT, set_block(), and set_noblock(). Referenced by port_recv(). |
|
Send the message 'msg' down the socket in non-blocking mode and with failover. Inspired by code from the Apache web server.
Definition at line 539 of file net.c. References ASSERT, len, SELECT_TIMEOUT, set_block(), and set_noblock(). Referenced by d_check_process(), and port_send(). |