#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
Go to the source code of this file.
Defines | |
| #define | RW_BUFFER 2048 |
| #define | RW_SOCKBUFFER 65535 /* socket layer read/write buffer */ |
| #define | NET_IP_STRBUF |
Functions | |
| EXTERN_C_BEGIN LIBGIFT_EXPORT void | net_close (int fd) |
| LIBGIFT_EXPORT int | net_connect (const char *ip, in_port_t port, BOOL blocking) |
| LIBGIFT_EXPORT int | net_accept (int sock, BOOL blocking) |
| LIBGIFT_EXPORT int | net_bind (in_port_t port, BOOL blocking) |
| LIBGIFT_EXPORT int | net_set_blocking (int fd, BOOL blocking) |
| LIBGIFT_EXPORT int | net_sock_error (int fd) |
| LIBGIFT_EXPORT int | net_send (int fd, const char *data, size_t len) |
| LIBGIFT_EXPORT in_addr_t | net_ip (const char *ip_str) |
| LIBGIFT_EXPORT char * | net_ip_str (in_addr_t ip) |
| LIBGIFT_EXPORT char * | net_ip_strbuf (in_addr_t ip, char *buf, size_t size) |
| LIBGIFT_EXPORT in_addr_t | net_peer (int fd) |
| LIBGIFT_EXPORT char * | net_peer_ip (int fd) |
| LIBGIFT_EXPORT in_addr_t | net_local_ip (int fd, in_port_t *port) |
| LIBGIFT_EXPORT in_addr_t | net_mask (int bitwidth) |
| LIBGIFT_EXPORT BOOL | net_match_host (in_addr_t ip, char *match) |
| LIBGIFT_EXPORT uint8_t | net_get8 (unsigned char *src) |
| LIBGIFT_EXPORT uint16_t | net_get16 (unsigned char *src, int tohost) |
| LIBGIFT_EXPORT uint32_t | net_get32 (unsigned char *src, int tohost) |
| LIBGIFT_EXPORT void | net_put8 (unsigned char *dst, uint8_t src) |
| LIBGIFT_EXPORT void | net_put16 (unsigned char *dst, uint16_t src) |
| LIBGIFT_EXPORT void | net_put32 (unsigned char *dst, uint32_t src) |
| LIBGIFT_EXPORT int | net_sock_adj_buf (int fd, int buf_name, float factor) |
Contains high-level abstraction of the low-level socket functions. Most of these routines are meant for TCP socket manipulation only, but UDP will likely come in the future. UI developers should make sure they see tcp_open before using any of these routines.
|
|
Defined when net_ip_strbuf is to be provided. This causes a slight slowdown in net_ip_str, and should be disabled if the functionality will never be used. |
|
|
Sane network block size. |
|
|
Socket layer read/write buffer. Used for throttling of bandwidth usage during large transfers. |
|
||||||||||||
|
Accept an incoming connection.
|
|
||||||||||||
|
Bind (and listen) on the specified port.
|
|
|
Close a socket file descriptor. Use this routine if portability is important to you.
|
|
||||||||||||||||
|
Make an outgoing TCP connection
|
|
|
Wrapper for inet_addr. |
|
|
Formats an IPv4 address for display.
|
|
||||||||||||||||
|
Similar to net_ip_str except that the supplied buffer will be used to copy the inet_ntoa(3) result into. net_ip_str uses its own internal buffer when this function is provided so that they will never collide. |
|
||||||||||||
|
Determine the locally bound ip address and optionally port. |
|
|
Returns a network mask.
|
|
||||||||||||
|
Matches an IP address against a worded notation.
|
|
|
Determine the peer IP address.
|
|
|
Wrapper for net_peer which passes the result to net_ip_str. |
|
||||||||||||||||
|
Send data over the socket
|
|
||||||||||||
|
Manually change the blocking status of a socket that has already been created.
|
|
|
Check if the socket has any pending errors resulting from a previous socket operation. If you are using a non-blocking socket scheme you will need to use this function when the selected socket gains the WRITE state after sending a connect request.
|
1.3.7