![]() |
RTEMS 6.1-rc7
|
This source file contains the implementation of UDP network fake functions related to tftpfs testing. More...
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
#include <ctype.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <rtems/test.h>
#include "tftpfs_udp_network_fake.h"
Data Structures | |
struct | control_data |
Macros | |
#define | IPV4_ADDR_SIZE 4 |
#define | MAX_SOCKET_FD 4 |
Typedefs | |
typedef struct control_data | control_data |
Functions | |
int | __wrap_close (int fd) |
int | __real_close (int fd) |
void | _Tftp_Reset (void) |
Initialize and free the singleton control object. | |
void * | _Tftp_Append_interaction (Tftp_Action_kind kind, Tftp_Interaction_fn fn, size_t size) |
Create an interaction and append it to the sequence of expected interactions. | |
bool | _Tftp_Has_no_more_interactions (void) |
Have all queued interactions been processed? | |
const char * | _Tftp_Get_error_str (uint16_t error_code) |
Provides a human readable description for an error code from an TFTP error packet. | |
int | inet_aton (const char *cp, struct in_addr *inp) |
struct hostent * | gethostbyname (const char *name) |
int | socket (int domain, int type, int protocol) |
int | bind (int sockfd, const struct sockaddr *addr, socklen_t addrlen) |
int | setsockopt (int sockfd, int level, int optname, const void *optval, socklen_t optlen) |
ssize_t | sendto (int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen) |
ssize_t | recvfrom (int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) |
This source file contains the implementation of UDP network fake functions related to tftpfs testing.
The libtftpfs source code is situated in the RTEMS repository. For testing it, either libbsd or RTEMS legacy networking would be required. This implies that the tests for libtftpfs would need to be placed in the libbsd repository - a different one than the libtftpfs source code.
Yet, libtftpfs uses only a handful of networking functions. This file provides fake implementations of those functions. These fake functions permit to simulate the exchange of UDP packets with the libtftpfs code and thus permits testing libtftpfs without the need of a full network stack.