2022-06-02 08:18:43 +00:00
|
|
|
//
|
|
|
|
// 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"
|
2022-06-13 10:49:12 +00:00
|
|
|
#include "misc.h"
|
2023-03-17 07:42:15 +00:00
|
|
|
#include "common.h"
|
2022-06-02 08:18:43 +00:00
|
|
|
|
2022-06-06 03:46:09 +00:00
|
|
|
#define PPPOE_MAX_TIMEOUT (30)
|
2022-06-02 08:18:43 +00:00
|
|
|
|
|
|
|
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 {
|
2022-06-06 03:46:09 +00:00
|
|
|
unsigned int timeout;
|
|
|
|
unsigned int count;
|
2022-06-02 08:18:43 +00:00
|
|
|
} RETRY_WORK;
|
|
|
|
|
2022-06-06 03:46:09 +00:00
|
|
|
typedef struct {
|
|
|
|
unsigned short sessionId;
|
|
|
|
char clientIp[MAX_IP_V4_STR];
|
|
|
|
char clientGw[MAX_IP_V4_STR];
|
|
|
|
char clientMask[MAX_IP_V4_STR];
|
|
|
|
char clientMac[MAX_MAC_ADDR_STR];
|
2022-06-07 03:29:05 +00:00
|
|
|
char svrBaseMac[MAX_MAC_ADDR_STR];
|
2022-06-06 03:46:09 +00:00
|
|
|
} PPPOE_SESSION_DATA, *PPPPOE_SESSION_DATA;
|
|
|
|
|
2022-06-02 08:18:43 +00:00
|
|
|
typedef struct {
|
|
|
|
unsigned int userid;
|
|
|
|
struct netif *nicif;
|
|
|
|
struct netif *pppif;
|
|
|
|
ppp_pcb *ppp;
|
|
|
|
|
2022-06-06 03:46:09 +00:00
|
|
|
RETRY_WORK retry;
|
2022-06-02 08:18:43 +00:00
|
|
|
|
2022-06-06 03:46:09 +00:00
|
|
|
PPPOE_SESSION_DATA data;
|
|
|
|
|
|
|
|
PPPOE_TASK status;
|
2022-06-02 08:18:43 +00:00
|
|
|
} PPPOE_SESSION, *PPPPOE_SESSION;
|
|
|
|
|
|
|
|
typedef struct {
|
2022-06-06 03:46:09 +00:00
|
|
|
unsigned int userid;
|
|
|
|
unsigned int vni;
|
|
|
|
unsigned short q1;
|
|
|
|
unsigned short q2;
|
2022-06-02 08:18:43 +00:00
|
|
|
unsigned char mac_addr[6];
|
|
|
|
const char *pppoe_user;
|
|
|
|
const char *pppoe_passwd;
|
2022-06-06 03:46:09 +00:00
|
|
|
} USER_PARAMS, *PUSER_PARAMS;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned int vni;
|
|
|
|
unsigned short q1;
|
|
|
|
unsigned short q2;
|
|
|
|
} VXLAN_TAG, *PVXLAN_TAG;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned char mac_addr[6];
|
|
|
|
const char *pppoe_user;
|
|
|
|
const char *pppoe_passwd;
|
2022-06-02 08:18:43 +00:00
|
|
|
} USER_INFO, *PUSER_INFO;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned int userid;
|
2022-06-06 03:46:09 +00:00
|
|
|
VXLAN_TAG vxlan;
|
2022-06-15 06:36:09 +00:00
|
|
|
unsigned char mac_addr[6];
|
2022-06-02 08:18:43 +00:00
|
|
|
USER_INFO user_info;
|
|
|
|
PPPOE_SESSION session;
|
|
|
|
|
2022-06-06 03:46:09 +00:00
|
|
|
USER_STATUS user_status;
|
|
|
|
|
|
|
|
UT_hash_handle hh_id;
|
|
|
|
UT_hash_handle hh_vxlan;
|
2022-06-15 06:36:09 +00:00
|
|
|
UT_hash_handle hh_mac;
|
2022-06-02 08:18:43 +00:00
|
|
|
} 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
|
2022-12-06 06:42:41 +00:00
|
|
|
#endif //VCPE_PROJECT_PPPOE_INFO_H
|