52typedef struct ppp_device {
77 int (*detect)(
struct ppp_device *self);
83 int (*init)(
struct ppp_device *self);
103 int (*tx)(
struct ppp_device *self,
const uint8_t *data,
size_t len,
115 const uint8_t *(*rx)(
struct ppp_device *self, ssize_t *out_len);
121#define PPP_TX_END_OF_PKT 0x00000001
133typedef struct ppp_proto {
152 int (*init)(
struct ppp_proto *self);
174 int (*input)(
struct ppp_proto *self,
const uint8_t *buf,
size_t len);
189 void (*enter_phase)(
struct ppp_proto *self,
int oldp,
int newp);
200 void (*check_timeouts)(
struct ppp_proto *self, uint64_t tm);
206#define PPP_PROTO_ENTRY_INIT { NULL, NULL }
217#define PPP_PHASE_DEAD 0x01
218#define PPP_PHASE_ESTABLISH 0x02
219#define PPP_PHASE_AUTHENTICATE 0x03
220#define PPP_PHASE_NETWORK 0x04
221#define PPP_PHASE_TERMINATE 0x05
276int ppp_send(
const uint8_t *data,
size_t len, uint16_t proto);
327#define PPP_FLAG_AUTH_PAP 0x00000001
328#define PPP_FLAG_AUTH_CHAP 0x00000002
329#define PPP_FLAG_PCOMP 0x00000004
330#define PPP_FLAG_ACCOMP 0x00000008
331#define PPP_FLAG_MAGIC_NUMBER 0x00000010
332#define PPP_FLAG_WANT_MRU 0x00000020
333#define PPP_FLAG_NO_ACCM 0x00000040
int ppp_lcp_send_proto_reject(uint16_t proto, const uint8_t *pkt, size_t len)
Send a Protocol Reject packet on the link.
uint32_t ppp_get_peer_flags(void)
Get the flags set for the peer's side of the link.
int ppp_connect(void)
Establish a point-to-point link across a previously set-up device.
int ppp_del_protocol(ppp_protocol_t *hnd)
Unregister a protocol from the PPP stack.
int ppp_set_login(const char *username, const char *password)
Set the login credentials used to authenticate to the peer.
void ppp_set_flags(uint32_t flags)
Set the flags set for our side of the link.
int ppp_shutdown(void)
Shut down the PPP library.
int ppp_init(void)
Initialize the PPP library.
int ppp_send(const uint8_t *data, size_t len, uint16_t proto)
Send a packet on the PPP link.
uint32_t ppp_get_flags(void)
Get the flags set for our side of the link.
int ppp_scif_init(int bps)
Initialize the Dreamcast serial port for a PPP link.
int ppp_set_device(ppp_device_t *dev)
Set the device used to do PPP communications.
int ppp_modem_init(const char *number, int blind, int *conn_rate)
Initialize the Dreamcast modem for a PPP link.
int ppp_add_protocol(ppp_protocol_t *hnd)
Register a protocol with the PPP stack.
int shutdown(int socket, int how)
Shutdown socket send and receive operations.
PPP device structure.
Definition ppp.h:52
int index
Unit index (starts at zero and counts upwards for multiple network devices of the same type).
Definition ppp.h:61
void * privdata
Private, device-specific data.
Definition ppp.h:71
uint32_t flags
Device flags.
Definition ppp.h:66
const char * descr
Long description of the device.
Definition ppp.h:57
const char * name
Device name ("modem", "scif", etc).
Definition ppp.h:54
PPP Protocol structure.
Definition ppp.h:133
const char * name
Protocol name ("lcp", "pap", etc).
Definition ppp.h:138
void * privdata
Private data (if any).
Definition ppp.h:144
TAILQ_ENTRY(ppp_proto) entry
Protocol list entry (not a function!).
uint16_t code
Protocol code.
Definition ppp.h:141