E:/fip/workspaces/fip/source/fip.h File Reference

This file contains definitions and macros which are used within both fip and the user application which uses fip. More...

Go to the source code of this file.

Data Structures

struct  fip_ip6addr_flags_t
 Holds flags with additional information about any addresses. More...
struct  fip_ip6addr_t
 IPv6 address, held as an array of 16 bytes. More...
struct  fip_myip6addr_t
 IPv6 address with additional state. More...
struct  fip_myip6prefix_t
 IPv6 Prefix with additional state. More...
struct  fip_mydefrouter_t
 IPv6 Default Router with additional state. More...
struct  fip_ip6frag_attr_t
 Scratchpad for IPv6 Fragmentation. More...

Defines

#define FIP_EXTHDR_OPT_ACTIONSKIP   (0<<6)
 skip over this option and continue processing the header.
#define FIP_EXTHDR_OPT_ACTIONDROP   (1<<6)
 discard the packet and, regardless of whether or not the packet's Destination Address was a multicast address, send an ICMP Parameter Problem, Code 2, message to the packet's Source Address, pointing to the unrecognized Option Type.
#define FIP_EXTHDR_OPT_ACTIONFORCE   (2<<6)
 discard the packet and, only if the packet's Destination Address was not a multicast address, send an ICMP Parameter Problem, Code 2, message to the packet's Source Address, pointing to the unrecognized Option Type.
#define FIP_ICMPV6_CODE_ERRORROUTE   0
 Dest Unreachable: No route to dest.
#define FIP_ICMPV6_CODE_ERRORPROHIBIT   1
 Dest Unreachable: Administratively Prohibited.
#define FIP_ICMPV6_CODE_ERRORSCOPE   2
 Dest Unreachable: Beyond scope of source address.
#define FIP_ICMPV6_CODE_ERRORADDR   3
 Dest Unreachable: Address unreachable.
#define FIP_ICMPV6_CODE_ERRORPORT   4
 Dest Unreachable: Port unreachable.
#define FIP_ICMPV6_CODE_ERRORPOLICY   5
 Dest Unreachable: Source address failed ingress/egress policy.
#define FIP_ICMPV6_CODE_ERRORREJECT   6
 Dest Unreachable: Reject route to destination.
#define FIP_ICMPV6_CODE_ERRORTTL   0
 Time Exceeded: Hop limit exceeded in transit.
#define FIP_ICMPV6_CODE_ERRORFRAG   1
 Time Exceeded: Fragment reassembly time exceeded.
#define FIP_ICMPV6_CODE_ERRORGENERAL   0
 Parameter Problem: Erroneous header field encountered.
#define FIP_ICMPV6_CODE_ERRORNH   1
 Parameter Problem: Unrecognized Next Header type encountered.
#define FIP_ICMPV6_CODE_ERROROPT   2
 Parameter Problem: Unrecognized IPv6 option encountered.
#define fip_ll_addrLenInvalid(x)   (x > FIP_CONF_LLADDR_LEN)
 fip_types

Typedefs

typedef bool fip_bool_t
 Typedef the C99 bool type.
typedef uint32_t fip_vlifetime_t
 Address life-times.

Enumerations

enum  fip_return_t {
  RV_OK = 0, RV_UNKNOWN_ERROR, RV_MEMORY_ERROR, RV_PARAMETER_ERROR,
  RV_UNHANDLED, RV_ND6_INVALID_STATE, RV_ND6_NOENTRY, RV_RH4_SEGMENT_LEFT_ERROR,
  RV_RH4_HOPS_EXCEEDED, RV_RH4_ADDRESS_OFF_LINK, RV_RH4_PROCESS_NEXT_HEADER, RV_HBH_RPL_INSTANCE_ERROR,
  RV_HBH_RANK_ERROR
}
 The return value used when functions are only returning a status, and nothing else. More...
enum  fip_addrtype_t {
  ADDR_UNKNOWN = 0, ADDR_AUTOCONF = 1, ADDR_STATEFUL = 2, ADDR_MANUAL = 3,
  ADDR_MULTICAST
}
 Address types. More...
enum  fip_prefixstate_t { PREFIX_UNUSED = 0, PREFIX_USED }
 State of prefix in use on an interface. More...
enum  fip_routestate_t { ROUTE_UNUSED = 0, ROUTE_USED }
 State of route in use on an interface. More...
enum  fip_addrstate_t {
  ADDR_UNUSED = 0, ADDR_NEW, ADDR_TENATIVE, ADDR_OPTIMISTIC,
  ADDR_PREFERRED, ADDR_DEPRECATED, ADDR_DUPLICATE, ADDR_DELETE
}
 State of address in use on an interface. More...

Functions

void fip_init (void)
 Performs any initilization of fip that is required.
void fip_task (void)
 FIP Task function.
fip_return_t fip_ipUtils_generateAutoconfIID (unsigned char result[], const unsigned char llAddrPtr[], unsigned char llAddrLen)
 Generate a 64-bit IID from a Link-Layer Address.
void fip_ip_process (void)
 The IP Input Function.
void fip_ip_send (void)
uint16_t fip_ipUtils_checksum (uint16_t startingValue, uint8_t data[], unsigned int number)
 Take a checksum over a range of values held in a buffer.
uint16_t fip_ipUtils_checksum_tl (void)
 Performs a checksum over the Transport Layer & higher of the active packet.
uint16_t fip_ipUtils_checksum_pseudo6hdr (uint16_t startingValue, uint8_t type)
 Performs a checksum over the IPv6 pseudo-header.
void fip_ipUtils_IP6toString (char *s, uint8_t *ipaddr)
 Formats an IPv6 address to a string, compressing zeros if possible.
fip_return_t fip_ipUtils_stringToIP6 (const char *s, uint8_t *ipaddr)
 Formats a string to an IPv6 Address.
fip_bool_t fip_isSrcUnspecified (void)
 Check if the IPv6 Source Address is the unspecified address.
fip_bool_t fip_isDestUnspecified (void)
 Check if the IPv6 Dest Address is the unspecified address.
void fip_icmp6_process (void)
 The ICMPv6 Input Function.
fip_return_t fip_nd6_process (void)
 Process the current active buffer if it contains a ICMP-ND message.
void fip_icmp6_finalize (void)
 Finalize ICMPv6 Packets by calculating the checksum, setting the IPv6 lengths correctly, and marking the packet as ready to send.
void fip_icmp6_generateEchoRequest (fip_ifnum_t ifnum, fip_ip6addr_t *destAddr, unsigned int length)
 Generate an ICMPv6 Echo Request (ping) to a remote host.
void fip_icmp6_generateError (uint8_t type, uint8_t code, uint32_t parameter)
 Generate an ICMPv6 Error Message based on the packet in the current buffer.
void fip_llgeneric_input (const uint8_t *srcAddr, unsigned char srcAddrLen, const uint8_t *destAddr, unsigned char destAddrLen, const uint8_t *data, unsigned int dataLen)
 Generic Link-Layer (LL) Receive Function.
uint32_t fip_hostInterface_getSeconds32 (void)
 Host interface function.
uint16_t fip_hostInterface_getSeconds16 (void)
 Host interface function.
uint32_t fip_hostInterface_getMiliSeconds32 (void)
 Host interface function.
uint16_t fip_hostInterface_getMiliSeconds16 (void)
 Host interface function.
uint32_t fip_hostInterface_getRandom32 (void)
 Host interface function.


Detailed Description

This file contains definitions and macros which are used within both fip and the user application which uses fip.

Author:
Colin O'Flynn

Define Documentation

#define FIP_EXTHDR_OPT_ACTIONDROP   (1<<6)

discard the packet and, regardless of whether or not the packet's Destination Address was a multicast address, send an ICMP Parameter Problem, Code 2, message to the packet's Source Address, pointing to the unrecognized Option Type.

Referenced by fip_ip_process().

#define FIP_EXTHDR_OPT_ACTIONFORCE   (2<<6)

discard the packet and, only if the packet's Destination Address was not a multicast address, send an ICMP Parameter Problem, Code 2, message to the packet's Source Address, pointing to the unrecognized Option Type.

Referenced by fip_ip_process().

#define FIP_EXTHDR_OPT_ACTIONSKIP   (0<<6)

skip over this option and continue processing the header.

discard the packet.

Referenced by fip_ip_process().

#define fip_ll_addrLenInvalid (  )     (x > FIP_CONF_LLADDR_LEN)

fip_types

Act on Configuration

Referenced by fip_if_addLLAddress(), fip_ipUtils_generateAutoconfIID(), and fip_llgeneric_input().


Function Documentation

uint16_t fip_ipUtils_checksum ( uint16_t  startingValue,
uint8_t  data[],
unsigned int  number 
)

Take a checksum over a range of values held in a buffer.

Parameters:
startingValue Starting checksum value.
data Pointer to data
number Number of bytes to checksum.
Returns:
Resulting 16-bit checksum

References fip_ipUtils_checksum(), and fip_toUint16.

Referenced by fip_ipUtils_checksum(), fip_ipUtils_checksum_pseudo6hdr(), and fip_ipUtils_checksum_tl().

Here is the call graph for this function:

uint16_t fip_ipUtils_checksum_pseudo6hdr ( uint16_t  startingValue,
uint8_t  type 
)

Performs a checksum over the IPv6 pseudo-header.

Parameters:
startingValue Initial value of checksum, typically contains the result of the transport-layer checksum calculation
type The value of the next-header to use for the pseudo-checksum
Returns:
The 16-bit checksum.

References fip_ipUtils_checksum(), fip_ipUtils_checksum_pseudo6hdr(), fip_packet_getBufSizes(), and fip_packet_getFromIP6Hdr_srcPtr.

Referenced by fip_icmp6_finalize(), fip_icmp6_process(), fip_ipUtils_checksum_pseudo6hdr(), and fip_udp_sendFinish().

Here is the call graph for this function:

uint16_t fip_ipUtils_checksum_tl ( void   ) 

Performs a checksum over the Transport Layer & higher of the active packet.

Returns:
The 16-bit checksum.

References fip_ipUtils_checksum(), fip_ipUtils_checksum_tl(), fip_packet_getBufPtr, and fip_packet_getBufSize.

Referenced by fip_icmp6_finalize(), fip_icmp6_process(), fip_ipUtils_checksum_tl(), and fip_udp_sendFinish().

Here is the call graph for this function:

fip_return_t fip_ipUtils_generateAutoconfIID ( unsigned char  result[],
const unsigned char  llAddrPtr[],
unsigned char  llAddrLen 
)

Generate a 64-bit IID from a Link-Layer Address.

Parameters:
result Pointer to where to store the 64-bit IID
llAddrPtr Pointer to the link-layer address
llAddrLen Length of the link-layer address
Returns:

Todo:
raise exception

References fip_ipUtils_generateAutoconfIID(), fip_ll_addrLenInvalid, fip_memcpy_ucharLen, RV_OK, RV_PARAMETER_ERROR, and RV_UNKNOWN_ERROR.

Referenced by fip_if6_addAutoconfAddress(), fip_ipUtils_generateAutoconfIID(), sixComprAddr(), and sixUncompAddr().

Here is the call graph for this function:

void fip_ipUtils_IP6toString ( char *  s,
uint8_t *  ipaddr 
)

Formats an IPv6 address to a string, compressing zeros if possible.

Parameters:
s Pointer to resulting string
ipaddr Pointer to the address

References fip_ipUtils_IP6toString().

Referenced by fip_console(), fip_console_addr(), fip_console_neighbour(), fip_console_pref(), fip_console_route(), and fip_ipUtils_IP6toString().

Here is the call graph for this function:

fip_return_t fip_ipUtils_stringToIP6 ( const char *  s,
uint8_t *  ipaddr 
)

Formats a string to an IPv6 Address.

Parameters:
s Pointer to the string which holds the IPv6 Address
ipaddr pointer to where the resulting address should be stored
Returns:
0 if error, 1 if OK

References fip_ipUtils_stringToIP6(), fip_Uint16_getLSB, fip_Uint16_getMSB, RV_OK, and RV_PARAMETER_ERROR.

Referenced by fip_console(), fip_console_addr(), fip_console_ping6(), fip_console_pref(), fip_console_route(), fip_console_udp(), and fip_ipUtils_stringToIP6().

Here is the call graph for this function:

fip_bool_t fip_isDestUnspecified ( void   ) 

Check if the IPv6 Dest Address is the unspecified address.

Sets the associated flags as well in the packet buffer.

Returns:

References fip_packet_getAddrFlags, fip_packet_getFromIP6Hdr_destAddr, and fip_packet_setAddrFlags.

Referenced by fip_ip_send().

fip_bool_t fip_isSrcUnspecified ( void   ) 

Check if the IPv6 Source Address is the unspecified address.

Sets the associated flags as well in the packet buffer.

Returns:

References fip_packet_getAddrFlags, fip_packet_getFromIP6Hdr_srcAddr, and fip_packet_setAddrFlags.

Referenced by fip_nd6_generateNS(), fip_nd6_generateRS(), fip_nd6_processNS(), fip_nd6_processRS(), and fip_sixlowpanhc_compress().

void fip_task ( void   ) 

FIP Task function.

Should be called often by your main loop or RTOS. The entire FIP architecture is designed around the idea that the "state" of objects is modified somewhere. This requires processing to occur in response to that state. This processing is called out in this loop. This architecture allows a lot of flexibility; for example when a new address is configured in IPv6, the duplicate address detection (DAD) process is started here and not in the simple function which set up that new address. Thus if you don't want to run duplicate address detection for example as your network doesn't have multicast/broadcast, you can tune it here to skip DAD.

Todo:
: IPv4.2: Add IPv4 Handling into main task

References fip_hostInterface_getSeconds16(), fip_icmp6_generateError(), FIP_ICMPV6_CODE_ERRORFRAG, fip_if6_periodic(), fip_ip_process(), fip_ip_send(), fip_nd6_neighbourCache_getState, fip_nd6_neighbourCache_lookupByIp(), fip_packet_activeDrop(), fip_packet_activeQueuePacket(), fip_packet_activeUnqueuePacket(), fip_packet_getAttr, fip_packet_getFromIP6Hdr_isDestMulticast, fip_packet_setAttr, fip_packet_spGetPtr, fip_ds6_searchStatus_t::index, fip_ds6_searchStatus_t::itemFound, PS_IPFRAG, PS_LLSENDING, PS_PROCESSIP, PS_RECEIVINGLL, PS_SEND, PS_STARTLLSEND, PS_WAITING_AR, RV_OK, and TRACE.

Here is the call graph for this function:


Generated on Wed Dec 8 13:00:19 2010 for FIP by  doxygen 1.5.7.1