Dallas Semiconductor DS80C400 C Libraries Home Page

Main Page   Data Structures   File List   Data Fields   Globals  

rom400_netif.h File Reference


Detailed Description

Network interface library for the DS80C400.

This library allows a user to add network interface drivers to the network stack.

For detailed information on the DS80C400 please see the High-Speed Microcontroller User's Guide: DS80C400 Supplement.

Go to the source code of this file.

Defines

#define ROM400_NETIF_VERSION   2

Functions

unsigned int netif_version (void)
 Returns the version number of this NETIF library.

int netif_packetreceived (unsigned char *packet, int len)
 Submit an inbound packet to the network stack.

int netif_addinterface (char *name, unsigned long ip, unsigned long subnet, unsigned long gateway, unsigned char flags, int(*transmitter)(unsigned char *packet, int len), int mtu, unsigned char timeout)
 Add an interface to the network interface list.

int netif_removeinterface (char *name)
 Remove specified interface from the network interface list.

int netif_setdefaultinterface (char *name)
 Set the specified interface Ras default interface.


Define Documentation

#define ROM400_NETIF_VERSION   2
 

Version number associated with this header file. Should be the same as the version number returned by the netif_version function.

See also:
netif_version


Function Documentation

int netif_addinterface char *    name,
unsigned long    ip,
unsigned long    subnet,
unsigned long    gateway,
unsigned char    flags,
int(*    transmitter)(unsigned char *packet, int len),
int    mtu,
unsigned char    timeout
 

Add an interface to the network interface list.

Parameters:
name name of network interface (e.g. "ppp0")
ip IP address of the new interface (MSB first, e.g. 0x0a000002L for 10.0.0.2)
subnet subnet mask of the new interface (e.g. 0xff000000L for 255.0.0.0)
gateway gateway IP address of the new interface (e.g. 0x0a000001L for 10.0.0.1)
flags set to 1 if new interface should be the default interface (else 0)
transmitter address of the user supplied transmit function (see below)
mtu maximum transmission unit
timeout initial tcp timout period based on an 8Hz tick; must be 8, 16, 32,6 4 or 128 (default: 128)
Returns:
1 for success, 0 for failure
See also:
netif_removeinterface
The transmitter function int transmitter(unsigned char *packet, int len) should return 1 when the packet was successfully sent (or dropped) and the packet memory should be freed. If the packet couldn't be sent and the packet should be retried, the transmitter should return 0. The argument packet points to the IP packet data to be transmitted and length is the length of the IP packet. Note that the transmit function runs under interrupt. Registers are saved, but only thread-safe functions can be called.

int netif_packetreceived unsigned char *    packet,
int    len
 

Submit an inbound packet to the network stack.

Parameters:
packet IP packet
len length of the packet
Returns:
1 for success, 0 for failure

int netif_removeinterface char *    name
 

Remove specified interface from the network interface list.

Parameters:
name name of network interface to remove
Returns:
1 for success, 0 for failure
See also:
netif_addinterface
NOTE: The behavior of this function is not guaranteed if a network interface is removed while output traffic for the interface is still pending. It is recommended to close all sockets and delay for a few seconds before removing any network interface.

int netif_setdefaultinterface char *    name
 

Set the specified interface Ras default interface.

Parameters:
name name of network interface
Returns:
1 for success, 0 for failure

unsigned int netif_version void   
 

Returns the version number of this NETIF library.

Returns:
Version number of this NETIF library.


Copyright 2004 Dallas Semiconductor, Inc.. Documentation generated by Doxygen.