|
CAEN Utility
2.0.2
Utilities for CAEN projects
|
TCP/IP protocol. More...
Modules | |
| Safe versions of recv() and send() | |
| Safe versions of recv() and send() with mutex locking | |
| Platform independent wrappers of socket/accept/bind/listen/connect | |
| Simplified client/server functions | |
Functions | |
| int32_t | c_socket_init (void) |
| int32_t | c_socket_cleanup (void) |
| c_socket_t * | c_socket_new (void) |
| void | c_socket_delete (c_socket_t *socket) |
| void | c_socket_reset (c_socket_t *socket) |
| c_socket_t * | c_tcp_socket (void) |
| c_socket_t * | c_accept (const c_socket_t *sckt, struct sockaddr *addr, c_socklen_t *addrlen) |
| int | c_bind (const c_socket_t *sckt, const struct sockaddr *addr, c_socklen_t addrlen) |
| int | c_listen (const c_socket_t *sckt, int backlog) |
| int | c_connect (const c_socket_t *sckt, const struct sockaddr *addr, c_socklen_t addrlen) |
TCP/IP protocol.
| int32_t c_socket_init | ( | void | ) |
Wrapper to WSAStartup()
Definition at line 81 of file CAENSocket.c.
| int32_t c_socket_cleanup | ( | void | ) |
Wrapper to WSACleanup()
Definition at line 104 of file CAENSocket.c.
| c_socket_t* c_socket_new | ( | void | ) |
Call c_socket_init() and create a new c_socket_t structure. c_socket_t::socket left uninitialized
WSAStartup
Definition at line 124 of file CAENSocket.c.
| void c_socket_delete | ( | c_socket_t * | socket | ) |
Call c_socket_reset(), c_socket_cleanup() and free memory
| [in] | socket | the socket to clean |
Definition at line 134 of file CAENSocket.c.
| void c_socket_reset | ( | c_socket_t * | socket | ) |
Close the socket and set socket->socket to c_socket_invalid
| [in] | socket | the socket to reset |
Definition at line 143 of file CAENSocket.c.
| c_socket_t* c_tcp_socket | ( | void | ) |
Create a new c_socket_t where the socket has been initialized to socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
Definition at line 284 of file CAENSocket.c.
| c_socket_t* c_accept | ( | const c_socket_t * | sckt, |
| struct sockaddr * | addr, | ||
| c_socklen_t * | addrlen | ||
| ) |
Create a new c_socket_t where the socket has been initialized to accept(socket, addr, addrlen)
| [in] | sckt | a socket created with c_tcp_socket(), bound to a local address with c_bind(), and is listening for connections after a c_listen(). |
| [out] | addr | a pointer to a sockaddr structure, filled in with the address of the peer socket |
| [out] | addrlen | the actual size of the peer address |
Definition at line 302 of file CAENSocket.c.
| int c_bind | ( | const c_socket_t * | sckt, |
| const struct sockaddr * | addr, | ||
| c_socklen_t | addrlen | ||
| ) |
Bind a name to a socket
| [in] | sckt | a socket created with c_tcp_socket() |
| [in] | addr | the address to be assigned |
| [in] | addrlen | the size, in bytes, of the address structure pointed to by addr |
Definition at line 294 of file CAENSocket.c.
| int c_listen | ( | const c_socket_t * | sckt, |
| int | backlog | ||
| ) |
Marks the socket referred to by sckt as a passive socket
| [in] | sckt | a socket created with c_tcp_socket() |
| [in] | backlog | the maximum length to which the queue of pending connections for sckt may grow |
Definition at line 298 of file CAENSocket.c.
| int c_connect | ( | const c_socket_t * | sckt, |
| const struct sockaddr * | addr, | ||
| c_socklen_t | addrlen | ||
| ) |
Initiate a connection on a socket
| [in] | sckt | a socket created with c_tcp_socket() |
| [in] | addr | the address to which connect to |
| [in] | addrlen | the size, in bytes, of the address structure pointed to by addr |
Definition at line 312 of file CAENSocket.c.