iPXE
|
IPv4 tests. More...
#include <stdint.h>
#include <string.h>
#include <byteswap.h>
#include <ipxe/in.h>
#include <ipxe/test.h>
Go to the source code of this file.
Macros | |
#define | IPV4(a, b, c, d) htonl ( ( (a) << 24 ) | ( (b) << 16 ) | ( (c) << 8 ) | (d) ) |
Define inline IPv4 address. More... | |
#define | inet_ntoa_ok(addr, text) inet_ntoa_okx ( addr, text, __FILE__, __LINE__ ) |
#define | inet_aton_ok(text, addr) inet_aton_okx ( text, addr, __FILE__, __LINE__ ) |
#define | inet_aton_fail_ok(text) inet_aton_fail_okx ( text, __FILE__, __LINE__ ) |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void | inet_ntoa_okx (uint32_t addr, const char *text, const char *file, unsigned int line) |
Report an inet_ntoa() test result. More... | |
static void | inet_aton_okx (const char *text, uint32_t addr, const char *file, unsigned int line) |
Report an inet_aton() test result. More... | |
static void | inet_aton_fail_okx (const char *text, const char *file, unsigned int line) |
Report an inet_aton() failure test result. More... | |
static void | ipv4_test_exec (void) |
Perform IPv4 self-tests. More... | |
Variables | |
struct self_test ipv4_test | __self_test |
IPv4 self-test. More... | |
IPv4 tests.
Definition in file ipv4_test.c.
Define inline IPv4 address.
Definition at line 42 of file ipv4_test.c.
#define inet_ntoa_ok | ( | addr, | |
text | |||
) | inet_ntoa_okx ( addr, text, __FILE__, __LINE__ ) |
Definition at line 67 of file ipv4_test.c.
#define inet_aton_ok | ( | text, | |
addr | |||
) | inet_aton_okx ( text, addr, __FILE__, __LINE__ ) |
Definition at line 87 of file ipv4_test.c.
#define inet_aton_fail_ok | ( | text | ) | inet_aton_fail_okx ( text, __FILE__, __LINE__ ) |
Definition at line 104 of file ipv4_test.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Report an inet_ntoa() test result.
addr | IPv4 address |
text | Expected textual representation |
file | Test code file |
line | Test code line |
Definition at line 53 of file ipv4_test.c.
References addr, DBG, in, inet_ntoa(), ntohl, okx, and strcmp().
|
static |
Report an inet_aton() test result.
text | Textual representation |
addr | Expected IPv4 address |
file | Test code file |
line | Test code line |
Definition at line 78 of file ipv4_test.c.
References addr, DBG, inet_aton(), inet_ntoa(), okx, and in_addr::s_addr.
|
static |
Report an inet_aton() failure test result.
text | Textual representation |
file | Test code file |
line | Test code line |
Definition at line 97 of file ipv4_test.c.
References inet_aton(), and okx.
|
static |
Perform IPv4 self-tests.
Definition at line 111 of file ipv4_test.c.
References IN_IS_CLASSA, IN_IS_CLASSB, IN_IS_CLASSC, IN_IS_MULTICAST, inet_aton_fail_ok, inet_aton_ok, inet_ntoa_ok, IPV4, and ok.
struct self_test ipv4_test __self_test |
IPv4 self-test.
Definition at line 151 of file ipv4_test.c.