PPPoE devices (DSL)
[Device handling]

PPPoE devices scan functions. More...

Data Structures

struct  PPPoEPacketStruct
struct  PPPoETagStruct
struct  PPPoEConnectionStruct
struct  PacketCriteriaStruct

Defines

#define ETH_PPPOE_DISCOVERY   0x8863
#define ETH_PPPOE_SESSION   0x8864
#define CODE_PADI   0x09
#define CODE_PADO   0x07
#define CODE_PADR   0x19
#define CODE_PADS   0x65
#define CODE_PADT   0xA7
#define TAG_END_OF_LIST   0x0000
#define TAG_SERVICE_NAME   0x0101
#define TAG_AC_NAME   0x0102
#define TAG_HOST_UNIQ   0x0103
#define TAG_AC_COOKIE   0x0104
#define TAG_VENDOR_SPECIFIC   0x0105
#define TAG_RELAY_SESSION_ID   0x0110
#define TAG_SERVICE_NAME_ERROR   0x0201
#define TAG_AC_SYSTEM_ERROR   0x0202
#define TAG_GENERIC_ERROR   0x0203
#define MAX_ATTEMPTS   2
#define PADO_TIMEOUT   3
#define PPPOE_OVERHEAD   6
#define HDR_SIZE   (sizeof (struct ethhdr) + PPPOE_OVERHEAD)
#define MAX_PPPOE_PAYLOAD   (ETH_DATA_LEN - PPPOE_OVERHEAD)
#define TAG_HDR_SIZE   4
#define NOT_UNICAST(e)   ((e[0] & 0x01) != 0)

Typedefs

typedef struct PPPoEPacketStruct PPPoEPacket
typedef struct PPPoETagStruct PPPoETag
typedef void parse_func (uint16_t type, uint16_t len, unsigned char *data, void *extra)
typedef struct
PPPoEConnectionStruct 
PPPoEConnection
typedef struct PacketCriteriaStruct PacketCriteria

Functions

static int check_room (PPPoEConnection *conn, unsigned char *cursor, unsigned char *start, uint16_t len)
static int parse_packet (PPPoEConnection *conn, PPPoEPacket *packet, parse_func *func, void *extra)
static int open_interfaces (int n, PPPoEConnection *conns)
static void close_intefaces (int n, PPPoEConnection *conns)
static int send_packet (int fd, PPPoEPacket *pkt, size_t size)
static int receive_packet (int fd, PPPoEPacket *pkt, size_t *size)
static void parse_hostuniq (uint16_t type, uint16_t len, unsigned char *data, void *extra)
static int packet_for_me (PPPoEConnection *conn, PPPoEPacket *packet)
static void parse_pado_tags (uint16_t type, uint16_t len, unsigned char *data, void *extra)
static int send_padi (int n, PPPoEConnection *conns)
static int wait_for_pado (int n, PPPoEConnection *conns)
static void discovery (int n, PPPoEConnection *conns)
void hd_scan_pppoe (hd_data_t *hd_data2)

Detailed Description

PPPoE devices scan functions.


Define Documentation

#define CODE_PADI   0x09

Referenced by send_padi().

#define CODE_PADO   0x07

Referenced by wait_for_pado().

#define CODE_PADR   0x19
#define CODE_PADS   0x65
#define CODE_PADT   0xA7
#define ETH_PPPOE_DISCOVERY   0x8863

Referenced by open_interfaces(), and send_padi().

#define ETH_PPPOE_SESSION   0x8864
#define HDR_SIZE   (sizeof (struct ethhdr) + PPPOE_OVERHEAD)

Referenced by send_padi(), and wait_for_pado().

#define MAX_ATTEMPTS   2

Referenced by discovery().

#define MAX_PPPOE_PAYLOAD   (ETH_DATA_LEN - PPPOE_OVERHEAD)

Referenced by check_room().

#define NOT_UNICAST (  )     ((e[0] & 0x01) != 0)

Referenced by open_interfaces(), and wait_for_pado().

#define PADO_TIMEOUT   3

Referenced by wait_for_pado().

#define PPPOE_OVERHEAD   6
#define TAG_AC_COOKIE   0x0104
#define TAG_AC_NAME   0x0102

Referenced by parse_pado_tags().

#define TAG_AC_SYSTEM_ERROR   0x0202

Referenced by parse_pado_tags().

#define TAG_END_OF_LIST   0x0000

Referenced by parse_packet().

#define TAG_GENERIC_ERROR   0x0203

Referenced by parse_pado_tags().

#define TAG_HDR_SIZE   4

Referenced by parse_packet(), and send_padi().

#define TAG_HOST_UNIQ   0x0103

Referenced by parse_hostuniq(), and send_padi().

#define TAG_RELAY_SESSION_ID   0x0110
#define TAG_SERVICE_NAME   0x0101

Referenced by parse_pado_tags(), and send_padi().

#define TAG_SERVICE_NAME_ERROR   0x0201

Referenced by parse_pado_tags().

#define TAG_VENDOR_SPECIFIC   0x0105

Typedef Documentation

typedef void parse_func(uint16_t type, uint16_t len, unsigned char *data, void *extra)
typedef struct PPPoETagStruct PPPoETag

Function Documentation

static int check_room ( PPPoEConnection conn,
unsigned char *  cursor,
unsigned char *  start,
uint16_t  len 
) [static]
static void close_intefaces ( int  n,
PPPoEConnection conns 
) [static]

References PPPoEConnectionStruct::fd.

Referenced by discovery().

static void discovery ( int  n,
PPPoEConnection conns 
) [static]
void hd_scan_pppoe ( hd_data_t hd_data2  ) 
static int open_interfaces ( int  n,
PPPoEConnection conns 
) [static]
static int packet_for_me ( PPPoEConnection conn,
PPPoEPacket packet 
) [static]
static void parse_hostuniq ( uint16_t  type,
uint16_t  len,
unsigned char *  data,
void *  extra 
) [static]

References TAG_HOST_UNIQ, and val.

Referenced by packet_for_me().

static int parse_packet ( PPPoEConnection conn,
PPPoEPacket packet,
parse_func func,
void *  extra 
) [static]
static void parse_pado_tags ( uint16_t  type,
uint16_t  len,
unsigned char *  data,
void *  extra 
) [static]
static int receive_packet ( int  fd,
PPPoEPacket pkt,
size_t *  size 
) [static]

References ADD2LOG.

Referenced by wait_for_pado().

static int send_packet ( int  fd,
PPPoEPacket pkt,
size_t  size 
) [static]

References ADD2LOG.

Referenced by send_padi().

static int send_padi ( int  n,
PPPoEConnection conns 
) [static]
static int wait_for_pado ( int  n,
PPPoEConnection conns 
) [static]