ReactOS 0.4.16-dev-297-gc569aee
test_pppos.c
Go to the documentation of this file.
1#include "test_pppos.h"
2
3#include "lwip/netif.h"
4#include "netif/ppp/pppos.h"
5#include "netif/ppp/ppp.h"
6
7#if PPP_SUPPORT && PPPOS_SUPPORT
8static struct netif pppos_netif;
9static ppp_pcb *ppp;
10
11static u32_t ppp_output_cb(ppp_pcb *pcb, const void *data, u32_t len, void *ctx)
12{
13 LWIP_UNUSED_ARG(pcb);
17
18 return 0;
19}
20
21static void ppp_link_status_cb(ppp_pcb *pcb, int err_code, void *ctx)
22{
23 LWIP_UNUSED_ARG(pcb);
24 LWIP_UNUSED_ARG(err_code);
26}
27
28static void pppos_setup(void)
29{
30 ppp = pppos_create(&pppos_netif, ppp_output_cb, ppp_link_status_cb, NULL);
31 fail_if(ppp == NULL);
32 ppp_connect(ppp, 0);
33}
34
35static void pppos_teardown(void)
36{
37}
38
39START_TEST(test_pppos_empty_packet_with_valid_fcs)
40{
41 u8_t two_breaks[] = { 0x7e, 0, 0, 0x7e };
42 u8_t other_packet[] = { 0x7e, 0x7d, 0x20, 0x00, 0x7e };
43 /* Set internal states of the underlying pcb */
44 pppos_pcb *pppos = (pppos_pcb *)ppp->link_ctx_cb;
45
47
48 pppos->open = 1; /* Pretend the connection is open already */
49 pppos->in_accm[0] = 0xf0; /* Make sure 0x0's are not escaped chars */
50
51 pppos_input(ppp, two_breaks, sizeof(two_breaks));
52 pppos_input(ppp, other_packet, sizeof(other_packet));
53
54}
55END_TEST
56
58Suite *
59pppos_suite(void)
60{
61 testfunc tests[] = {
62 TESTFUNC(test_pppos_empty_packet_with_valid_fcs)
63 };
64 return create_suite("PPPOS", tests, sizeof(tests)/sizeof(testfunc), pppos_setup, pppos_teardown);
65}
66
67#endif /* PPP_SUPPORT && PPPOS_SUPPORT */
#define START_TEST(x)
Definition: atltest.h:75
#define NULL
Definition: types.h:112
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLsizei len
Definition: glext.h:6722
uint32_t u32_t
Definition: arch.h:129
uint8_t u8_t
Definition: arch.h:125
#define LWIP_UNUSED_ARG(x)
Definition: arch.h:373
Suite * create_suite(const char *name, testfunc *tests, size_t num_tests, SFun setup, SFun teardown)
#define TESTFUNC(x)
Definition: lwip_check.h:22
static struct test_info tests[]
Definition: netif.h:269