Watt-32 tcp/ip  2.2 dev-rel.10
Enumerations | Functions | Variables
pppoe.c File Reference

Go to the source code of this file.

Enumerations

enum  States {
  STATE_NONE = 0,
  STATE_DISCOVERY,
  STATE_SESSION
}
 

Functions

static void (W32_CALL *prev_hook)(const char *
 
static int pppoe_send_disc (int code)
 Build and send a PADx (PPPoE Active Discovery) packet as link-layer broadcast or unicast.
 
static void W32_CALL pppoe_config (const char *name, const char *value)
 
static BOOL pppoe_wait (int wait_code)
 Loop waiting for timeout or a PAD response. More...
 
static BOOL pppoe_discovery (void)
 The PPPoE Discovery handler. More...
 
void pppoe_init (void)
 Set config-parser hook and initial values.
 
int pppoe_start (void)
 Start PPPoE by doing a Discovery. More...
 
void pppoe_exit (void)
 Close down PPPoE by sending a PADT.
 
int pppoe_handler (const pppoe_Packet *pkt)
 Handle incoming PPPoE packets.
 
BOOL pppoe_is_up (const void *dest)
 Determine if we have a PPPoE session with the machine given by 'dest'. More...
 
static WORD build_pad (struct pppoe_Packet *pkt, WORD code)
 Build a PADx packet.
 
int pppoe_send_sess (const void *sock, const BYTE *buf, WORD len)
 Build and send a PPPoE Session packet (IPCP or LCP packet).
 
voidpppoe_mac_format (union link_Packet *tx)
 Build a PPPoE session packet header. More...
 

Variables

static const char *static BOOL got_PADO = NULL
 
static BOOL got_PADS
 
static BOOL got_PADT
 
static BOOL got_PADM
 
static WORD session = 0
 
static enum States state = STATE_NONE
 
static mac_address ac_mac_addr
 
struct {
   int   enable
 
   int   trace
 
   int   timeout
 
   int   retries
 
   int   lcp_echo_intv
 Not used.
 
   char   service_name [MAX_VALUELEN+1]
 
   char   user_name [MAX_VALUELEN+1]
 
   char   password [MAX_VALUELEN+1]
 
cfg = { 0, 0, 1, 3, 60, "", "", "" }
 

Detailed Description

PPPoE (PPP-over-Ethernet) for Watt-32. Refer RFC-2516 for spec.

Copyright (c) 1997-2002 Gisle Vanem gvane.nosp@m.m@ya.nosp@m.hoo.n.nosp@m.o

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by Gisle Vanem Bergen, Norway.

THIS SOFTWARE IS PROVIDED BY ME (Gisle Vanem) AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL I OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Version

0.5 : Aug 07, 2001 : G. Vanem - created 0.6 : Aug 08, 2001 : Added extensions from draft-carrel-info-pppoe-ext-00.txt

Definition in file pppoe.c.

Function Documentation

static BOOL pppoe_discovery ( void  )
static

The PPPoE Discovery handler.

Send PAD Init, wait for PAD offer, send PAD Request and wait for PAD Session confirmation.

Definition at line 137 of file pppoe.c.

References pppoe_send_disc(), and pppoe_wait().

BOOL pppoe_is_up ( const void dest)

Determine if we have a PPPoE session with the machine given by 'dest'.

Can only have a session with the AC.

Definition at line 287 of file pppoe.c.

References _eth_mac_len.

void* pppoe_mac_format ( union link_Packet tx)

Build a PPPoE session packet header.

Only called for IPv4 packets.

Definition at line 377 of file pppoe.c.

References _eth_addr, and _pkt_ip_ofs.

int pppoe_start ( void  )

Start PPPoE by doing a Discovery.

Adjust MSS/MTU for PPPoE packets (8 byte less than normal DIX ethernet). Enter Session state and kick-start PPP (LCP/IPCP).

Todo:
Fix-me: The new MTU/MSS affects all connections (also those which doesn't use PPPoE framing).

Definition at line 184 of file pppoe.c.

References _pktdevclass, and pppoe_discovery().

static BOOL pppoe_wait ( int  wait_code)
static

Loop waiting for timeout or a PAD response.

Blocks until some got_X flags are set in by pppoe_handler().

Definition at line 110 of file pppoe.c.

References chk_timeout(), set_timeout(), and tcp_tick().

Variable Documentation

char user_name[MAX_VALUELEN+1]
Todo:
PPP user/passwd not handled

Definition at line 83 of file pppoe.c.