44 uint8_t tx_accm[32], rx_accm[32];
47 unsigned char *rx_bufp;
53 void initialize_rxbuffer();
57 ahdlc(PPPInterface *pIf);
60 void receive(
char *buffer,
int count);
61 void sendone(
int fd,
char c);
62 void transmit(
int fd,
char *buffer,
int n);
63 void set_tx_accm(uint32_t tx_accm);
64 void set_rx_accm(uint32_t rx_accm);
99#define ERR_PPP_SUCCESS (0)
100#define ERR_PPP_ALREADY_OPEN (-1)
101#define ERR_PPP_NO_DIALTONE (-2)
102#define ERR_PPP_NO_ANSWER (-3)
103#define ERR_PPP_BUSY (-4)
104#define ERR_PPP_FAIL (-5)
105#define ERR_PPP_PASSFAIL (-6)
106#define ERR_PPP_LOSTCARRIER (-7)
107#define ERR_PPP_NO_MODEM (-8)
108#define ERR_PPP_LCP_FAILED (-9)
109#define ERR_PPP_CHAPFAIL (-10)
117 beuint16_t PPPFrameType;
122} __attribute__((packed)) PPPFRAME;
129 uint32_t options_ok_mask;
130 uint32_t options_nak_mask;
131 uint32_t options_rej_mask;
132 uint16_t m_TicksLeft;
134 uint16_t m_FrameType;
135 uint16_t m_nRequests_Sent;
136 LCPState_Class *pNextLayerUp;
137 LCPState_Class *pNextLayerDn;
138 uint8_t m_Last_ReqSent;
139 uint8_t m_Last_ReqRespond;
143 void RecieveMsg(PPPFRAME *pPPP,
PoolPtr pp);
144 virtual void TestOption(puint8_t option_start, uint32_t maskv) = 0;
151 void Initialize(PPPInterface *ppi, uint16_t frame_type, LCPState_Class *next_layer, LCPState_Class *pre_layer);
153 void SendPPPBuffer(
PoolPtr ppSend);
154 void SendProtoReject(PPPFRAME *pPPP,
PoolPtr pp);
157 void SetState(
int i);
160 virtual void do_scr() = 0;
161 virtual void do_RCN(PPPFRAME *pPPP,
int reject) = 0;
162 virtual void do_wereup();
163 virtual void do_weredown();
164 void do_sca(PPPFRAME *pPPP,
PoolPtr pp);
165 void do_scn(PPPFRAME *pPPP,
PoolPtr pp);
166 void CopyOptions(PPPFRAME *pPPPOut, PPPFRAME *pPPPin, uint32_t option_mask);
168 void do_sta(PPPFRAME *pPPP,
PoolPtr pp);
169 void do_ser(PPPFRAME *pPPP,
PoolPtr pp);
173class LCP_Class :
public LCPState_Class
176 virtual void TestOption(puint8_t option_start, uint32_t maskv);
177 virtual void do_scr();
178 virtual void do_RCN(PPPFRAME *pPPP,
int reject);
179 virtual void do_wereup();
180 virtual void do_weredown();
183class IPCP_Class :
public LCPState_Class
186 virtual void TestOption(puint8_t option_start, uint32_t maskv);
187 virtual void do_scr();
188 virtual void do_RCN(PPPFRAME *pPPP,
int reject);
189 virtual void do_wereup();
190 virtual void do_weredown();
196 PPPInterface(
const char *name =
"PPP",
const char *pDesc =
"PPP Interface");
201 3,
"Restart_Interval",
202 "Seconds to wait to restart failed negotiation"};
204 "Max times to send terminate request before giving up"};
207 "Max number of config request loops before giving up"};
209 "The max number of config failure before giving up"};
210 config_bool DNSRequest{
true,
"DNSRequest",
"Request DNS from the other side of the connection"};
211 config_bool CHAPenable{
true,
"CHAPEnable",
"Enable CHAP authentication"};
212 config_bool RestartOnClose{
false,
"RestartOnclose",
"Restart PPP automatically from close"};
213 config_pass UserName{
"nburn",
"User",
"PPP Username for this interface"};
214 config_pass PassWord{
"nburn",
"Password",
"PPP Password for this interface"};
215 uint32_t TX_DESIRED_ACCM;
216 uint32_t RX_DESIRED_ACCM;
217 config_IPADDR4 OfferedDNSAddress{
"0.0.0.0",
"OfferedDNS",
"Offer a DNS address to the other side"};
226 volatile int abort_ppp;
228 volatile bool abortornot;
229 volatile bool m_bDataSeen;
230 volatile uint32_t NextTick;
238 volatile uint16_t PPPIds;
240 const char *hang_string;
249 uint32_t CurrentRand[4];
252 slcompress VJHCStruct;
253 ahdlc ahdlc_obj{
this};
254 LCP_Class lcp_automaton;
255 IPCP_Class ipcp_automaton;
259 virtual void send_func(
PoolPtr poolPtr);
260 virtual bool LinkActive();
261 virtual int LinkSpeed();
262 virtual bool LinkDuplex();
263 virtual bool bNeedsArp();
267 void EnableMulticast(
MACADR macAddress, BOOL addAddress);
269 void ClosePPPSesion();
272 void ProcessPAP(PPPFRAME *pPPP,
PoolPtr pp);
273 void ProcessPPPIP(PPPFRAME *pPPP,
PoolPtr pp);
274 void SendCHAP(uint8_t code, uint8_t
id = 0);
275 void SendCHAPChallenge();
277 void ProcessCHAP(PPPFRAME *pPPP,
PoolPtr pp);
279 void UpdateTimeout();
284 static void PPPDaemonTask(
void *p);
285 static PPPInterface *pListHead;
288class PPPServer :
public PPPInterface
291 PPPServer(
const char *name =
"PPPS",
const char *pDesc =
"PPP Server Interface");
294class PPPClient :
public PPPInterface
297 PPPClient(
const char *name =
"PPPC",
const char *pDesc =
"PPP Server Interface");
Network interface configuration block class for interface control and configuration.
Definition netinterface.h:245
Used to store and manipulate MAC addresses.
Definition nettypes.h:69
Configuration Variable for IPADDR4 (IPv4) object types.
Definition config_obj.h:1493
Boolean Configuration Variable.
Definition config_obj.h:997
Signed 32-bit Integer Configuration Variable.
Definition config_obj.h:700
Password string Configuration Variable.
Definition config_obj.h:1343
enum_PPPState
PPP States.
Definition ppp.h:78
@ eClosed
Connection closed.
Definition ppp.h:79
@ eLCPNegotiate
LCP negotiation.
Definition ppp.h:85
@ eClosing
Connection closing.
Definition ppp.h:90
@ eWaitForTrain
Waiting for train.
Definition ppp.h:84
@ ePAPAuthenticate
PAP authentication.
Definition ppp.h:86
@ eDialing
Dialing.
Definition ppp.h:81
@ eOpen
Connection open.
Definition ppp.h:89
@ eAnswering
Answering incoming connection.
Definition ppp.h:83
@ eCHAPAuthenticate
CHAP authentication.
Definition ppp.h:87
@ eNCPNegotiate
NCP negotiation.
Definition ppp.h:88
@ eWait4Ring
Waiting for ring indicator.
Definition ppp.h:82
@ eInitializingModem
Initializing modem.
Definition ppp.h:80
NetBurner Network Interface Header File.
NetBurner IPADDR4 Class. See the IPADDR4 Class page for complete documentation.
Semaphores are used to control access to shared resources or or to communicate between tasks in a mul...
Definition nbrtos.h:411
Main buffer structure for network and serial communication.
Definition buffers.h:90