libhd  5.0
Data Structures | Macros | Typedefs | Functions

PPPoE devices scan functions. More...

Data Structures

struct  PPPoEPacketStruct
 
struct  PPPoETagStruct
 
struct  PPPoEConnectionStruct
 
struct  PacketCriteriaStruct
 

Macros

#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 /* type, code, session, length */
 
#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.

Macro Definition Documentation

◆ CODE_PADI

#define CODE_PADI   0x09

Referenced by send_padi().

◆ CODE_PADO

#define CODE_PADO   0x07

Referenced by wait_for_pado().

◆ CODE_PADR

#define CODE_PADR   0x19

◆ CODE_PADS

#define CODE_PADS   0x65

◆ CODE_PADT

#define CODE_PADT   0xA7

◆ ETH_PPPOE_DISCOVERY

#define ETH_PPPOE_DISCOVERY   0x8863

Referenced by open_interfaces(), and send_padi().

◆ ETH_PPPOE_SESSION

#define ETH_PPPOE_SESSION   0x8864

◆ HDR_SIZE

#define HDR_SIZE   (sizeof (struct ethhdr) + PPPOE_OVERHEAD)

Referenced by send_padi(), and wait_for_pado().

◆ MAX_ATTEMPTS

#define MAX_ATTEMPTS   2

Referenced by discovery().

◆ MAX_PPPOE_PAYLOAD

#define MAX_PPPOE_PAYLOAD   (ETH_DATA_LEN - PPPOE_OVERHEAD)

Referenced by check_room().

◆ NOT_UNICAST

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

Referenced by open_interfaces(), and wait_for_pado().

◆ PADO_TIMEOUT

#define PADO_TIMEOUT   3

Referenced by wait_for_pado().

◆ PPPOE_OVERHEAD

#define PPPOE_OVERHEAD   6 /* type, code, session, length */

◆ TAG_AC_COOKIE

#define TAG_AC_COOKIE   0x0104

◆ TAG_AC_NAME

#define TAG_AC_NAME   0x0102

Referenced by parse_pado_tags().

◆ TAG_AC_SYSTEM_ERROR

#define TAG_AC_SYSTEM_ERROR   0x0202

Referenced by parse_pado_tags().

◆ TAG_END_OF_LIST

#define TAG_END_OF_LIST   0x0000

Referenced by parse_packet().

◆ TAG_GENERIC_ERROR

#define TAG_GENERIC_ERROR   0x0203

Referenced by parse_pado_tags().

◆ TAG_HDR_SIZE

#define TAG_HDR_SIZE   4

Referenced by parse_packet(), and send_padi().

◆ TAG_HOST_UNIQ

#define TAG_HOST_UNIQ   0x0103

Referenced by parse_hostuniq(), and send_padi().

◆ TAG_RELAY_SESSION_ID

#define TAG_RELAY_SESSION_ID   0x0110

◆ TAG_SERVICE_NAME

#define TAG_SERVICE_NAME   0x0101

Referenced by parse_pado_tags(), and send_padi().

◆ TAG_SERVICE_NAME_ERROR

#define TAG_SERVICE_NAME_ERROR   0x0201

Referenced by parse_pado_tags().

◆ TAG_VENDOR_SPECIFIC

#define TAG_VENDOR_SPECIFIC   0x0105

Typedef Documentation

◆ PacketCriteria

◆ parse_func

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

◆ PPPoEConnection

◆ PPPoEPacket

◆ PPPoETag

typedef struct PPPoETagStruct PPPoETag

Function Documentation

◆ check_room()

static int check_room ( PPPoEConnection conn,
unsigned char *  cursor,
unsigned char *  start,
uint16_t  len 
)
static

◆ close_intefaces()

static void close_intefaces ( int  n,
PPPoEConnection conns 
)
static

References PPPoEConnectionStruct::fd.

Referenced by discovery().

◆ discovery()

static void discovery ( int  n,
PPPoEConnection conns 
)
static

◆ hd_scan_pppoe()

void hd_scan_pppoe ( hd_data_t hd_data2)

◆ open_interfaces()

static int open_interfaces ( int  n,
PPPoEConnection conns 
)
static

◆ packet_for_me()

static int packet_for_me ( PPPoEConnection conn,
PPPoEPacket packet 
)
static

◆ parse_hostuniq()

static void parse_hostuniq ( uint16_t  type,
uint16_t  len,
unsigned char *  data,
void *  extra 
)
static

References TAG_HOST_UNIQ.

Referenced by packet_for_me().

◆ parse_packet()

static int parse_packet ( PPPoEConnection conn,
PPPoEPacket packet,
parse_func func,
void *  extra 
)
static

◆ parse_pado_tags()

static void parse_pado_tags ( uint16_t  type,
uint16_t  len,
unsigned char *  data,
void *  extra 
)
static

◆ receive_packet()

static int receive_packet ( int  fd,
PPPoEPacket pkt,
size_t *  size 
)
static

References ADD2LOG.

Referenced by wait_for_pado().

◆ send_packet()

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

References ADD2LOG.

Referenced by send_padi().

◆ send_padi()

static int send_padi ( int  n,
PPPoEConnection conns 
)
static

◆ wait_for_pado()

static int wait_for_pado ( int  n,
PPPoEConnection conns 
)
static