embedded IPsec source code documentation


dumpdev.h File Reference


Detailed Description

Header file fof the dummy network adapter.

Author:
Christian Scheurer <http://www.christianscheurer.ch>
This document is part of embedded IPsec
Copyright (c) 2003 Niklaus Schild and Christian Scheurer, HTI Biel/Bienne
All rights reserved.

Definition in file dumpdev.h.

#include "lwip/netif.h"

Go to the source code of this file.

Data Structures

struct  dumpdev_stats

Functions

err_t dumpdev_init (struct netif *)
err_t dumpdev_output (struct netif *, struct pbuf *, struct ip_addr *)
err_t dumpdev_netlink_output (struct netif *netif, struct pbuf *p)
void dumpdev_input (struct netif *)
void dumpdev_service (struct netif *)


Function Documentation

err_t dumpdev_init struct netif *  netif  ) 
 

Initialize the dump network device

This function must be called prior to any other operation with this device. It sets the device name, MAC address, initializes statistics and performs general configuration of the "dumpdev" device.

Parameters:
netif lwIP network interface data structure for this device. The structure must be initialized with IP, netmask and gateway address.
Returns:
err_t return code

Definition at line 389 of file dumpdev.c.

void dumpdev_input struct netif *  netif  ) 
 

This function is used to transfer a received packet in newly allocated pbuf-memory and pass it to upper protocol layers.

Note: this is the place where the dumped packets are injected and passed to higher protocol layers. It simulates the reception of a packet over the physical connection.

Parameters:
netif initialized lwIP network interface data structure of this device
Returns:
void
Todo:
simulate reception of new packets HERE

replace this loop with memcpy()

ATTENTION: should be real IP, not -1

If there is no INBOUND packet in the input queue, inject a sample ESP packet to check the stacks behavior

Definition at line 215 of file dumpdev.c.

err_t dumpdev_netlink_output struct netif *  netif,
struct pbuf *  p
 

This function simulates the low-level network interface

Note: This function does currently nothing but return ERR_OK

Parameters:
netif initialized lwIP network interface data structure of this device
p pbuf containing a complete Ethernet frame as payload
Returns:
err_t status

Definition at line 368 of file dumpdev.c.

err_t dumpdev_output struct netif *  netif,
struct pbuf *  p,
struct ip_addr *  ipaddr
 

This function is used to send a packet out of the network device.

Before dumping the frame (which is equivalent to sending data over the wire in a real Ethernet driver), the MAC address must be resolved using the ARP module. After the MAC address has been found, the packet will be "sent" (dumped).

Note: this is the place where an automated check of outbound data can be added.

Parameters:
netif initialized lwIP network interface data structure of this device
p pbuf containing a complete Ethernet frame as payload
ipaddr destination address
Returns:
err_t status

Definition at line 341 of file dumpdev.c.

void dumpdev_service struct netif *  netif  ) 
 

This function must be called at regular intervals (i.g. 20 times per second). It will allow the dump device driver to perform pending operations, such as emptying the transmit buffer or feeding newly received data into the TCP/IP stack.

Parameters:
netif initialized lwIP network interface data structure of this device
Returns:
void

Definition at line 198 of file dumpdev.c.


Copyright 2003 by Christian Scheurer and Niklaus Schild