KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Data Structures | Macros | Typedefs | Functions
netcfg.h File Reference

Network configuration interface. More...

#include <sys/cdefs.h>
#include <arch/types.h>

Go to the source code of this file.

Data Structures

struct  netcfg
 Network configuration information. More...
 

Macros

#define NETCFG_METHOD_DHCP   0
 Use DHCP to configure. More...
 
#define NETCFG_METHOD_STATIC   1
 Static network configuration. More...
 
#define NETCFG_METHOD_PPPOE   4
 Use PPPoE. More...
 
#define NETCFG_SRC_VMU   0
 Read from a VMU. More...
 
#define NETCFG_SRC_FLASH   1
 Read from the flashrom. More...
 
#define NETCFG_SRC_CWD   2
 Read from the working directory. More...
 
#define NETCFG_SRC_CDROOT   3
 Read from the root of the CD. More...
 

Typedefs

typedef struct netcfg netcfg_t
 Network configuration information. More...
 

Functions

int netcfg_load_from (const char *fn, netcfg_t *out)
 Load network configuration from a file. More...
 
int netcfg_load_flash (netcfg_t *out)
 Load network configuration from the Dreamcast's flashrom. More...
 
int netcfg_load (netcfg_t *out)
 Load network configuration. More...
 
int netcfg_save_to (const char *fn, const netcfg_t *cfg)
 Save network configuration to a file. More...
 
int netcfg_save (const netcfg_t *cfg)
 Save network configuration to the first available VMU. More...
 

Detailed Description

Network configuration interface.

This file provides a common interface for reading and writing the network configuration on KOS. The interface can read from the flashrom on the Dreamcast or from a file (such as on a VMU or the like), and can write data back to a file.

The data that is written out by this code is written in a relatively easy to parse text-based format.

Author
Dan Potter

Typedef Documentation

typedef struct netcfg netcfg_t

Network configuration information.

This structure contains information about the network configuration of the system, as set up by the user.

Function Documentation

int netcfg_load ( netcfg_t out)

Load network configuration.

This function loads the network configuration data, searching in multiple locations to attempt to find a file with a stored configurtion. This function will attempt to read the configuration from each VMU first (from a file named net.cfg), then it will try the flashrom, followed by the current working directory, and lastly the root of the CD.

Parameters
outBuffer to store the parsed configuraiton.
Returns
0 on success, <0 on failure.
int netcfg_load_flash ( netcfg_t out)

Load network configuration from the Dreamcast's flashrom.

This function loads the network configuration that is stored in flashrom of the Dreamcast, parsing it into a netcfg_t.

Parameters
outBuffer to store the parsed configuration.
Returns
0 on success, <0 on failure.
Note
This currently does not read the configuration stored by the PlanetWeb browser at all.
int netcfg_load_from ( const char *  fn,
netcfg_t out 
)

Load network configuration from a file.

This function loads the network configuration that is stored in the given file to the network configuration structure passed in. This function will also handle files on the VMU with the VMU specific header attached without any extra work required.

Parameters
fnThe file to read the configuration from.
outBuffer to store the parsed configuration.
Returns
0 on success, <0 on failure.
int netcfg_save ( const netcfg_t cfg)

Save network configuration to the first available VMU.

This function saves the network configuration to first VMU that it finds. It will not retry if the first VMU doesn't have enough space to hold the file.

Parameters
cfgThe configuration to save.
Returns
0 on success, <0 on failure.
int netcfg_save_to ( const char *  fn,
const netcfg_t cfg 
)

Save network configuration to a file.

This function saves the network configuration to the specified file. This function will automatically prepend the appropriate header if it is saved to a VMU.

Parameters
fnThe file to save to.
cfgThe configuration to save.
Returns
0 on success, <0 on failure.