vcpe/srcs/include/pppoe_info.h

73 lines
1.4 KiB
C
Raw Normal View History

//
// Created by xajhuang on 2022/5/31.
//
#ifndef VCPE_PROJECT_PPPOE_INFO_H
#define VCPE_PROJECT_PPPOE_INFO_H
#ifdef __cplusplus
extern "C" {
#endif
#include <uthash/uthash.h>
#include "netif/ppp/ppp.h"
#define PPPOE_MAX_TIMEOUT (30)
typedef enum {
STATUS_TASK_INIT,
STATUS_TASK_DIAL,
STATUS_TASK_CONNECTED,
STATUS_TASK_ERROR,
STATUS_TASK_DISCONNECTED,
STATUS_TASK_DELETE,
STATUS_PPPOE_UPDATE,
} PPPOE_TASK;
typedef enum {
STATUS_USER_NEW,
STATUS_USER_DELETE,
STATUS_USER_MODIFY,
STATUS_USER_NORMAL,
} USER_STATUS;
typedef struct {
unsigned int timeout;
unsigned int count;
} RETRY_WORK;
typedef struct {
unsigned int userid;
struct netif *nicif;
struct netif *pppif;
ppp_pcb *ppp;
RETRY_WORK retry;
PPPOE_TASK status;
} PPPOE_SESSION, *PPPPOE_SESSION;
typedef struct {
unsigned short qinq_tag1;
unsigned short qinq_tag2;
unsigned char mac_addr[6];
const char *pppoe_user;
const char *pppoe_passwd;
USER_STATUS user_status;
} USER_INFO, *PUSER_INFO;
typedef struct {
unsigned int userid;
USER_INFO user_info;
PPPOE_SESSION session;
UT_hash_handle hh;
} USER_INFO_CONTEXT, *PUSER_INFO_CONTEXT;
int pppoe_session_create(PUSER_INFO_CONTEXT pUser);
int pppoe_session_init();
struct netif *get_rawsocket_if(void);
#ifdef __cplusplus
}
#endif
#endif//VCPE_PROJECT_PPPOE_INFO_H