| Files | |
| file | nettest.c | 
| Networking test support functions implementation. | |
| file | nettest.h | 
| Networking test support functions. | |
| file | nettest1.c | 
| Networking test 1 application - sockets. | |
| file | nettest2.c | 
| Networking test 2 application - transfer. | |
| Defines | |
| #define | NAME "Nettest2" | 
| Echo module name. | |
| #define | NAME "Nettest1" | 
| Echo module name. | |
| #define | NETTEST1_TEXT "Networking test 1 - sockets" | 
| Packet data pattern. | |
| #define | NETTEST2_TEXT "Networking test 2 - transfer" | 
| Packet data pattern. | |
| Functions | |
| int | main (int argc, char *argv[]) | 
| static void | nettest1_fill_buffer (char *buffer, size_t size) | 
| Fill buffer with the NETTEST1_TEXT pattern. | |
| static int | nettest1_parse_opt (int argc, char *argv[], int *index) | 
| Parse one command-line option. | |
| static void | nettest1_print_help (void) | 
| static int | nettest1_test (int *socket_ids, int nsockets, int nmessages) | 
| static void | nettest2_fill_buffer (char *buffer, size_t size) | 
| Fill buffer with the NETTEST2_TEXT pattern. | |
| static int | nettest2_parse_opt (int argc, char *argv[], int *index) | 
| Parse one command-line option. | |
| static void | nettest2_print_help (void) | 
| void | print_mark (int index) | 
| Prints a mark. | |
| int | sockets_close (int verbose, int *socket_ids, int sockets) | 
| Closes sockets. | |
| int | sockets_connect (int verbose, int *socket_ids, int sockets, struct sockaddr *address, socklen_t addrlen) | 
| Connects sockets. | |
| int | sockets_create (int verbose, int *socket_ids, int sockets, int family, sock_type_t type) | 
| Creates new sockets. | |
| int | sockets_recvfrom (int verbose, int *socket_ids, int sockets, struct sockaddr *address, socklen_t *addrlen, char *data, int size, int messages) | 
| Receives data via sockets. | |
| int | sockets_sendto (int verbose, int *socket_ids, int sockets, struct sockaddr *address, socklen_t addrlen, char *data, int size, int messages) | 
| Sends data via sockets. | |
| int | sockets_sendto_recvfrom (int verbose, int *socket_ids, int sockets, struct sockaddr *address, socklen_t *addrlen, char *data, int size, int messages) | 
| Sends and receives data via sockets. | |
| Variables | |
| static struct sockaddr * | address | 
| static socklen_t | addrlen | 
| static char * | data | 
| static int | family | 
| static int | family = PF_INET | 
| static int | messages | 
| static int | messages | 
| static uint16_t | port | 
| static uint16_t | port | 
| static size_t | size | 
| static size_t | size = 27 | 
| static int | sockets | 
| static int | sockets | 
| static sock_type_t | type | 
| static sock_type_t | type = SOCK_DGRAM | 
| static bool | verbose | 
| static int | verbose = 0 | 
| int main | ( | int | argc, | |
| char * | argv[] | |||
| ) | 
Definition at line 287 of file nettest1.c.
| static void nettest1_fill_buffer | ( | char * | buffer, | |
| size_t | size | |||
| ) |  [static] | 
Fill buffer with the NETTEST1_TEXT pattern.
| buffer | Data buffer. | |
| size | Buffer size in bytes. | 
Definition at line 209 of file nettest1.c.
| static int nettest1_parse_opt | ( | int | argc, | |
| char * | argv[], | |||
| int * | index | |||
| ) |  [static] | 
Parse one command-line option.
| argc | Number of all command-line arguments. | |
| argv | All command-line arguments. | |
| index | Current argument index (in, out). | 
Definition at line 110 of file nettest1.c.
| static void nettest2_fill_buffer | ( | char * | buffer, | |
| size_t | size | |||
| ) |  [static] | 
Fill buffer with the NETTEST2_TEXT pattern.
| buffer | Data buffer. | |
| size | Buffer size in bytes. | 
Definition at line 105 of file nettest2.c.
| static int nettest2_parse_opt | ( | int | argc, | |
| char * | argv[], | |||
| int * | index | |||
| ) |  [static] | 
Parse one command-line option.
| argc | Number of all command-line arguments. | |
| argv | All command-line arguments. | |
| index | Current argument index (in, out). | 
Definition at line 126 of file nettest2.c.
| void print_mark | ( | int | index | ) | 
| int sockets_close | ( | int | verbose, | |
| int * | socket_ids, | |||
| int | sockets | |||
| ) | 
Closes sockets.
| [in] | verbose | A value indicating whether to print out verbose information. | 
| [in] | socket_ids | A field of stored socket identifiers. | 
| [in] | sockets | The number of sockets in the field. Should be at most the size of the field. | 
Other error codes as defined for the closesocket() function.
| int sockets_connect | ( | int | verbose, | |
| int * | socket_ids, | |||
| int | sockets, | |||
| struct sockaddr * | address, | |||
| socklen_t | addrlen | |||
| ) | 
Connects sockets.
| [in] | verbose | A value indicating whether to print out verbose information. | 
| [in] | socket_ids | A field of stored socket identifiers. | 
| [in] | sockets | The number of sockets in the field. Should be at most the size of the field. | 
| [in] | address | The destination host address to connect to. | 
| [in] | addrlen | The length of the destination address in bytes. | 
Other error codes as defined for the connect() function.
| int sockets_create | ( | int | verbose, | |
| int * | socket_ids, | |||
| int | sockets, | |||
| int | family, | |||
| sock_type_t | type | |||
| ) | 
Creates new sockets.
| [in] | verbose | A value indicating whether to print out verbose information. | 
| [out] | socket_ids | A field to store the socket identifiers. | 
| [in] | sockets | The number of sockets to create. Should be at most the size of the field. | 
| [in] | family | The socket address family. | 
| [in] | type | The socket type. | 
Other error codes as defined for the socket() function.
| int sockets_recvfrom | ( | int | verbose, | |
| int * | socket_ids, | |||
| int | sockets, | |||
| struct sockaddr * | address, | |||
| socklen_t * | addrlen, | |||
| char * | data, | |||
| int | size, | |||
| int | messages | |||
| ) | 
Receives data via sockets.
| [in] | verbose | A value indicating whether to print out verbose information. | 
| [in] | socket_ids | A field of stored socket identifiers. | 
| [in] | sockets | The number of sockets in the field. Should be at most the size of the field. | 
| [in] | address | The source host address of received datagrams. | 
| [in,out] | addrlen | The maximum length of the source address in bytes. The actual size of the source address is set instead. | 
| [out] | data | The received data. | 
| [in] | size | The maximum data size in bytes. | 
| [in] | messages | The number of datagrams per socket to be received. | 
Other error codes as defined for the recvfrom() function.
| int sockets_sendto | ( | int | verbose, | |
| int * | socket_ids, | |||
| int | sockets, | |||
| struct sockaddr * | address, | |||
| socklen_t | addrlen, | |||
| char * | data, | |||
| int | size, | |||
| int | messages | |||
| ) | 
Sends data via sockets.
| [in] | verbose | A value indicating whether to print out verbose information. | 
| [in] | socket_ids | A field of stored socket identifiers. | 
| [in] | sockets | The number of sockets in the field. Should be at most the size of the field. | 
| [in] | address | The destination host address to send data to. | 
| [in] | addrlen | The length of the destination address in bytes. | 
| [in] | data | The data to be sent. | 
| [in] | size | The data size in bytes. | 
| [in] | messages | The number of datagrams per socket to be sent. | 
Other error codes as defined for the sendto() function.
| int sockets_sendto_recvfrom | ( | int | verbose, | |
| int * | socket_ids, | |||
| int | sockets, | |||
| struct sockaddr * | address, | |||
| socklen_t * | addrlen, | |||
| char * | data, | |||
| int | size, | |||
| int | messages | |||
| ) | 
Sends and receives data via sockets.
Each datagram is sent and a reply read consequently. The next datagram is sent after the reply is received.
| [in] | verbose | A value indicating whether to print out verbose information. | 
| [in] | socket_ids | A field of stored socket identifiers. | 
| [in] | sockets | The number of sockets in the field. Should be at most the size of the field. | 
| [in,out] | address | The destination host address to send data to. The source host address of received datagrams is set instead. | 
| [in] | addrlen | The length of the destination address in bytes. | 
| [in,out] | data | The data to be sent. The received data are set instead. | 
| [in] | size | The data size in bytes. | 
| [in] | messages | The number of datagrams per socket to be received. | 
Other error codes as defined for the recvfrom() function.
 1.4.7
 1.4.7