KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
ppp_device_t Struct Reference

PPP device structure. More...

#include <ppp/ppp.h>

Data Fields

const char * name
 Device name ("modem", "scif", etc).
 
const char * descr
 Long description of the device.
 
int index
 Unit index (starts at zero and counts upwards for multiple network devices of the same type).
 
uint32_t flags
 Device flags.
 
void * privdata
 Private, device-specific data.
 
int(* detect )(struct ppp_device *self)
 Attempt to detect the device.
 
int(* init )(struct ppp_device *self)
 Initialize the device.
 
int(* shutdown )(struct ppp_device *self)
 Shutdown the device.
 
int(* tx )(struct ppp_device *self, const uint8_t *data, size_t len, uint32_t flags)
 Transmit data on the device.
 
const uint8_t *(* rx )(struct ppp_device *self, ssize_t *out_len)
 Poll for queued receive data.
 

Detailed Description

PPP device structure.

This structure defines a basic output device for PPP packets. This structure is largely modeled after netif_t from the main network stack, with a bit of functionality removed that is irrelevant for PPP.

Note that we only allow one device and one connection in this library.

Field Documentation

◆ descr

const char* ppp_device_t::descr

Long description of the device.

◆ detect

int(* ppp_device_t::detect) (struct ppp_device *self)

Attempt to detect the device.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.

◆ flags

uint32_t ppp_device_t::flags

Device flags.

The lowest 16 bits of this value are reserved for use by libppp. You are free to use the other 16 bits as you see fit in your driver.

◆ index

int ppp_device_t::index

Unit index (starts at zero and counts upwards for multiple network devices of the same type).

◆ init

int(* ppp_device_t::init) (struct ppp_device *self)

Initialize the device.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.

◆ name

const char* ppp_device_t::name

Device name ("modem", "scif", etc).

◆ privdata

void* ppp_device_t::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.

◆ rx

const uint8_t *(* ppp_device_t::rx) (struct ppp_device *self, ssize_t *out_len)

Poll for queued receive data.

This function will be called periodically by a thread to check the device for any new incoming data.

Parameters
selfThe network device in question.
Returns
A pointer to the received data on success. NULL on failure or if no data is waiting.

◆ shutdown

int(* ppp_device_t::shutdown) (struct ppp_device *self)

Shutdown the device.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.

◆ tx

int(* ppp_device_t::tx) (struct ppp_device *self, const uint8_t *data, size_t len, uint32_t flags)

Transmit data on the device.

This function will be called periodically to transmit data on the underlying device. The data passed in may not necessarily be a whole packet (check the flags to see what's being passed in).

Parameters
selfThe network device in question.
dataThe data to transmit.
lenThe length of the data to transmit in bytes.
flagsFlags to describe what data is being sent in.
Returns
0 on success, <0 on failure.

The documentation for this struct was generated from the following file: