Watt-32 tcp/ip  2.2 dev-rel.10
Data Structures | Functions | Variables
ppp.c File Reference

Go to the source code of this file.

Data Structures

struct  ppp_dispatch
 

Functions

static void ipcp_addr_req (struct ppp_state *state, struct ppp_xcp *xcp, const struct xcp_type *tp, const BYTE *buf, int len)
 
static void ipcp_addr_nak (struct ppp_state *state, struct ppp_xcp *xcp, const struct xcp_type *tp, const BYTE *buf, int len)
 
static void ipcp_addr_show (struct ppp_state *state, struct ppp_xcp *xcp, const struct xcp_type *tp, const BYTE *buf, int len)
 
static void send_event (struct ppp_state *state, struct ppp_xcp *xcp, enum ppp_event event)
 
static void change_phase (struct ppp_state *state, enum ppp_phase phase)
 
static void buffer_print (const char *verb, const BYTE *buf, int len)
 
static void safe_string (const BYTE *bp, int len)
 
static void option_show (const struct ppp_state *state, const struct ppp_xcp *xcp, const BYTE *bp, int rlen)
 
static void show_packet (const char *inout, const struct ppp_state *state, const struct ppp_xcp *xcp, const BYTE *bp, int len)
 
static void ppp_write (const struct ppp_state *state, const struct ppp_xcp *xcp, const BYTE *buf, int len)
 
static __inline BYTE * setup_acpf (BYTE *buf, WORD proto)
 
static BYTE * code_id (struct ppp_state *state, struct ppp_xcp *xcp, int code)
 
static BYTE * code_reply (struct ppp_state *state, struct ppp_xcp *xcp, int code)
 
static struct option_statefind_option (const struct ppp_xcp *xcp, int type)
 
static void create_request (struct ppp_state *state, struct ppp_xcp *xcp)
 
static void copy_peer_values (const struct ppp_state *state, struct ppp_xcp *xcp)
 
static void dispatch_action (struct ppp_state *state, struct ppp_xcp *xcp, enum xcp_action act)
 
static void check_timeouts (void)
 
void ppp_input (const BYTE *inbuffer, WORD len)
 The PPP input handler.
 
static void set_reject (struct ppp_state *state, struct ppp_xcp *xcp, const BYTE *bp)
 
static void set_nak (struct ppp_state *state, struct ppp_xcp *xcp, int type, int len, const BYTE *bp)
 
static int validate_request (struct ppp_state *state, struct ppp_xcp *xcp)
 
static void process_rcx (struct ppp_state *state, struct ppp_xcp *xcp, BYTE code)
 
static void std_negotiation (struct ppp_state *state, struct ppp_xcp *xcp)
 
static void init_xcp (const char *name, struct ppp_xcp *xcp, void(*deliver)(struct ppp_state *state, struct ppp_xcp *xcp), const struct xcp_type *types, int ntypes, WORD proto)
 
static void set_option_value_lcl (struct ppp_xcp *xcp, int type, int value)
 
static void set_option_value_rem (struct ppp_xcp *xcp, int type, int value)
 
void ppp_start (int dbg_level)
 

Variables

static DWORD remote_ip_base = 0x0A000000
 
static DWORD remote_ip_mask = 0xFF000000
 
static int debug = 0
 
static struct ppp_state mystate
 
static const struct xcp_type lcp_types []
 
static const struct xcp_type ipcp_types []
 
static const struct ppp_dispatch ppp_dispatch [10][16]
 
static const char * ph_str []
 
static const char * ev_str []
 
static const char * st_str []
 
static const char * ac_str []
 

Detailed Description

PPP tunneled over Ethernet (PPPOE_SESS_TYPE frames)

This implements just LCP and IPCP, and then only a subset of each of those. This is not supported and probably shouldn't be used for much more than simple experiments with PPP. If you need a real version of PPP, see Paul Mackerras' ppp-2.3. If you do try to use this, don't say I didn't warn you.

This code may be used for any purpose as long as the author's copyright is cited in any source code distributed. This code is also available electronically from the author's web site.

http://people.ne.mediaone.net/carlson/ppp

http://www.workingcode.com/ppp

Copyright 1997 by James Carlson and Working Code

Adapted for Watt-32's PPPoE extension by G. Vanem Aug-2000

Definition in file ppp.c.

Function Documentation

static void std_negotiation ( struct ppp_state state,
struct ppp_xcp xcp 
)
static
Todo:
extract LCP_MRU option

Definition at line 1081 of file ppp.c.

Variable Documentation

const char* ac_str[]
static
Initial value:
= {
"Null", "irc", "scr", "tls", "tlf", "str", "sta",
"sca", "scn", "scj", "tld", "tlu", "zrc", "ser"
}

Definition at line 304 of file ppp.c.

const char* ev_str[]
static
Initial value:
= {
"Up", "Down", "Open", "Close", "TO+", "TO-",
"RCR+", "RCR-", "RCA", "RCN", "RTR", "RTA",
"RUC", "RXJ+", "RXJ-", "RXR"
}

Definition at line 292 of file ppp.c.

const struct xcp_type ipcp_types[]
static
Initial value:
= {
{ "IP-Address", 3, 1, 6, 6, 0, ipcp_addr_req,
ipcp_addr_nak, ipcp_addr_show },
{ NULL, -1, 0, 0, 0, 0, NULL, NULL, NULL }
}

Definition at line 88 of file ppp.c.

const struct xcp_type lcp_types[]
static
Initial value:
= {
{ NULL, -1, 0, 0, 0, 0, NULL, NULL, NULL }
}

Definition at line 84 of file ppp.c.

const char* ph_str[]
static
Initial value:
= {
"Dead", "Establish", "Authenticate",
"Network", "Terminate"
}

Definition at line 287 of file ppp.c.

const char* st_str[]
static
Initial value:
= {
"Initial", "Starting", "Closed", "Stopped",
"Closing", "Stopping", "Req-Sent", "Ack-Rcvd",
"Ack-Sent", "Opened", "No-Change"
}

Definition at line 298 of file ppp.c.