10 #include <sys/cdefs.h>
14 #include <sys/types.h>
15 #include <sys/queue.h>
95 int (*
tx)(
struct ppp_device *
self,
const uint8_t *data,
size_t len,
107 const uint8_t *(*rx)(
struct ppp_device *
self, ssize_t *out_len);
111 #define PPP_TX_END_OF_PKT 0x00000001
193 #define PPP_PROTO_ENTRY_INIT { NULL, NULL }
202 #define PPP_PHASE_DEAD 0x01
203 #define PPP_PHASE_ESTABLISH 0x02
204 #define PPP_PHASE_AUTHENTICATE 0x03
205 #define PPP_PHASE_NETWORK 0x04
206 #define PPP_PHASE_TERMINATE 0x05
242 int ppp_set_login(
const char *username,
const char *password);
255 int ppp_send(
const uint8_t *data,
size_t len, uint16_t proto);
298 #define PPP_FLAG_AUTH_PAP 0x00000001
299 #define PPP_FLAG_AUTH_CHAP 0x00000002
300 #define PPP_FLAG_PCOMP 0x00000004
301 #define PPP_FLAG_ACCOMP 0x00000008
302 #define PPP_FLAG_MAGIC_NUMBER 0x00000010
303 #define PPP_FLAG_WANT_MRU 0x00000020
304 #define PPP_FLAG_NO_ACCM 0x00000040
383 int ppp_modem_init(
const char *number,
int blind,
int *conn_rate);
int ppp_send(const uint8_t *data, size_t len, uint16_t proto)
Send a packet on the PPP link.
int ppp_modem_init(const char *number, int blind, int *conn_rate)
Initialize the Dreamcast modem for a PPP link.
int ppp_shutdown(void)
Shut down the PPP library.
TAILQ_ENTRY(ppp_proto) entry
Protocol list entry (not a function!).
int(* input)(struct ppp_proto *self, const uint8_t *buf, size_t len)
Protocol packet input function.
Definition: ppp.h:163
const char * name
Device name ("modem", "scif", etc).
Definition: ppp.h:46
void ppp_set_flags(uint32_t flags)
Get the flags set for our side of the link.
PPP device structure.
Definition: ppp.h:44
int ppp_connect(void)
Establish a point-to-point link across a previously set-up device.
int ppp_init(void)
Initialize the PPP library.
void(* enter_phase)(struct ppp_proto *self, int oldp, int newp)
Notify the protocol of a PPP phase change.
Definition: ppp.h:178
int index
Unit index (starts at zero and counts upwards for multiple network devices of the same type)...
Definition: ppp.h:53
void * privdata
Private data (if any).
Definition: ppp.h:133
int(* tx)(struct ppp_device *self, const uint8_t *data, size_t len, uint32_t flags)
Transmit data on the device.
Definition: ppp.h:95
int(* shutdown)(struct ppp_proto *self)
Shutdown function.
Definition: ppp.h:151
int(* init)(struct ppp_proto *self)
Initialization function.
Definition: ppp.h:141
uint32_t ppp_get_flags(void)
Get the flags set for our side of the link.
int(* init)(struct ppp_device *self)
Initialize the device.
Definition: ppp.h:75
int ppp_add_protocol(ppp_protocol_t *hnd)
Register a protocol with the PPP stack.
void * privdata
Private, device-specific data. This can be used for whatever the driver deems fit. The PPP code won't touch this data at all. Set to NULL if you don't need anything here.
Definition: ppp.h:63
int ppp_lcp_send_proto_reject(uint16_t proto, const uint8_t *pkt, size_t len)
Send a Protocol Reject packet on the link.
struct ppp_device ppp_device_t
PPP device structure.
int ppp_scif_init(int bps)
Initialize the Dreamcast serial port for a PPP link.
PPP Protocol structure.
Definition: ppp.h:122
int ppp_del_protocol(ppp_protocol_t *hnd)
Unregister a protocol from the PPP stack.
struct ppp_proto ppp_protocol_t
PPP Protocol structure.
const char * descr
Long description of the device.
Definition: ppp.h:49
void(* check_timeouts)(struct ppp_proto *self, uint64_t tm)
Check timeouts for resending packets.
Definition: ppp.h:189
uint32_t flags
Device flags. The lowest 16 bits of this value are reserved for use by libppp. You are free to use th...
Definition: ppp.h:58
const char * name
Protocol name ("lcp", "pap", etc).
Definition: ppp.h:127
uint16_t code
Protocol code.
Definition: ppp.h:130
int(* detect)(struct ppp_device *self)
Attempt to detect the device.
Definition: ppp.h:69
uint32_t ppp_get_peer_flags(void)
Get the flags set for the peer's side of the link.
int ppp_set_login(const char *username, const char *password)
Set the login credentials used to authenticate to the peer.
int ppp_set_device(ppp_device_t *dev)
Set the device used to do PPP communications.
int(* shutdown)(struct ppp_device *self)
Shutdown the device.
Definition: ppp.h:81