KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Data Fields
ppp_device Struct Reference

PPP device structure. More...

#include <ppp/ppp.h>

Data Fields

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

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

const char* ppp_device::descr

Long description of the device.

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

Attempt to detect the device.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.
uint32_t ppp_device::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.

int ppp_device::index

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

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

Initialize the device.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.
const char* ppp_device::name

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

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

const uint8_t*(* ppp_device::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.
int(* ppp_device::shutdown)(struct ppp_device *self)

Shutdown the device.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.
int(* ppp_device::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: