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

Header for Active Packet Interface. More...

Go to the source code of this file.

Data Structures

struct  fip_packet_t
 Hold the current active packet. More...

Defines

#define fip_packet_getFromIP6Hdr_isSrcMulticast()   (*(fip_packet_getIPBufPtr() + 8) == 0xFF)
 Optimised function to check for IPv6 Multicast in source address.
#define fip_packet_getFromIP6Hdr_isDestMulticast()   (*(fip_packet_getIPBufPtr() + 24) == 0xFF)
 Optimized function to check for IPv6 Multicast in dest address.
#define fip_packet_getFromIP6Hdr_isDestLinkLocal()   (*(fip_packet_getIPBufPtr() + 24) == 0xFE)
#define fip_packet_getBufPtr(bufNum)   (fip_packet_get().buf[bufNum].ptr)
 Get a pointer to a specific buffer, such as the L2 buffer, IP buffer, etc.
#define fip_packet_getBufMaxSize(bufNum)   (fip_packet_get().buf[bufNum].allocSize)
 Get the allocated (maximum) size of a buffer.
#define fip_packet_getBufSize(bufNum)   (fip_packet_get().buf[bufNum].usedSize)
 Get the size of data currently written into the buffer.
#define fip_packet_setBufSize(bufNum, size)   (fip_packet_get().buf[bufNum].usedSize = size)
 Set the size of data currently written into the buffer.
#define fip_packet_getAttr(attr)   fip_packet_get().attr
 Get the value of an attribute from the active packet buffer.
#define fip_packet_setAttr(attr, value)   fip_packet_get().attr = (value)
 Set the value of an attribute to the active packet buffer.
#define fip_packet_setLLSrcAddr(addr, len)
 Set the LL source address, you must have set the srcLLAddrOffset attribute before calling this!
#define fip_packet_setLLDestAddr(addr, len)
 Set the LL dest address, you must have set the destLLAddrOffset attribute before calling this!
#define fip_packet_setAddrFlags(type, flag, value)   (fip_packet_get().type.flag = value)
 Set the address flags.
#define fip_packet_getAddrFlags(type, flag)   fip_packet_get().type.flag
 Get the address flags.
#define fip_packet_spGetPtr(type)   ((type *)(fip_packet_get().scratchPad))
 Get a pointer to the 'scratchpad', and cast it to a pointer of the type passed.
#define fip_packet_getFromBuf_Uint8Unaligned(offset, bufNum)
#define fip_packet_getIfNum()   fip_packet_getAttr(IFNum)
 Get the interface number, available as a separate macro as single-interface systems can replace this with a constant.
#define fip_packet_getFromIP6Hdr_nhOffset()   (6)
 Get the offset from the start of the IP buffer to the next header.
#define fip_packet_getFromIP6Hdr_destPtr()   (fip_packet_getIPBufPtr() + 24)
 Get a pointer to the IPv6 Destination Address.
#define fip_packet_getFromIP6Hdr_destAddr(x)   fip_packet_getFromIPBuf_Uint8Unaligned(x + 24)
 Get a single byte from the IPv6 Destination Address.
#define fip_packet_setToIP6Hdr_destAddr(x, data)   fip_packet_setToIPBuf_Uint8Unaligned(x + 24, data)
 Set a single byte to the IPv6 Destination Address.
#define fip_packet_getFromIP6Hdr_srcPtr()   (fip_packet_getIPBufPtr() + 8)
 Get a pointer to the IPv6 Source Address.
#define fip_packet_getFromIP6Hdr_srcAddr(x)   fip_packet_getFromIPBuf_Uint8Unaligned(x + 8)
 Get a single byte from the IPv6 Destination Address.
#define fip_packet_resetAddrFlags(type)
 Reset the flags associated with a certain address.
#define fip_packet_getFromIPHdr_version()   (fip_packet_getFromIPBuf_Uint8Aligned(0) & 0xF0)
 Get the IP version of this packet, equates to either FIP_IPHDR_V6 or FIP_IPHDR_V4.
#define fip_packet_getFromIP6Hdr_length()   (fip_toUint16(fip_packet_getFromIPBuf_Uint8Aligned(4), fip_packet_getFromIPBuf_Uint8Unaligned(5)))
 Get the length field of the IPv6 header.
#define fip_packet_setToIP6Hdr_length(data)   {fip_packet_setToIPBuf_Uint8Unaligned(4, fip_Uint16_getMSB(data)); fip_packet_setToIPBuf_Uint8Unaligned(5, fip_Uint16_getLSB(data));}
 Set the length field in the IPv6 header, Handles conversion to network order.
#define fip_packet_setToIP6Hdr_nextHeader(data)   (fip_packet_setToIPBuf_Uint8Unaligned(6, data))
 Set the next header field in the IPv6 Header.
#define fip_packet_setToIP6Hdr_hopLimit(data)   (fip_packet_setToIPBuf_Uint8Unaligned(7, data))
 Set the hop limit field in the IPv6 Header.
#define fip_packet_getFromICMP6Hdr_Type()   fip_packet_getFromBuf_Uint8(FIP_TLBUF, 0)
 Get the ICMPv6 'type' in the header.
#define fip_packet_getFromICMP6Hdr_Code()   fip_packet_getFromBuf_Uint8(FIP_TLBUF, 1)
 Get the ICMPv6 'Code' in the header.
#define fip_packet_setToICMP6Hdr_Type(data)   fip_packet_setToBuf_Uint8(FIP_TLBUF, 0, data)
 Set the ICMPv6 'type' in the header.
#define fip_packet_setToICMP6Hdr_Code(data)   fip_packet_setToBuf_Uint8(FIP_TLBUF, 1, data)
 Set the ICMPv6 'code' in the header.
#define fip_packet_setToICMP6Hdr_Checksum(data)   {fip_packet_setToBuf_Uint8(FIP_TLBUF, 2, fip_Uint16_getMSB((data))); fip_packet_setToBuf_Uint8(FIP_TLBUF, 3, fip_Uint16_getLSB((data)));}
 Set the ICMPv6 'checksum' in the header, converts byte order correctly.

Enumerations

enum  fip_packetstate_t {
  PS_UNUSED, PS_EMPTY, PS_RECEIVINGLL, PS_PROCESSIP,
  PS_WAITING_AR, PS_SEND, PS_IPFRAG, PS_STARTLLSEND,
  PS_LLSENDING
}
 Valid states the active packet buffer can be in. More...

Functions

fip_return_t fip_packet_activeNew (fip_bufnum_t bufnum, uint16_t length, fip_ifnum_t ifnum)
 Allocate a new packet & make active.
void fip_packet_activeBufSplit (fip_bufnum_t original, fip_bufnum_t new)
 Takes the specified origin buffer, and splits off all the free space (between allocSize and Size) and moves it to the new buffer, before using this function be SURE allocSize is set correctly in the 'original' buffer, and you don't have free space at the end.
void fip_packet_activeDrop (void)
 Deallocate the active packet.
fip_return_t fip_packet_activeResponsePacket (fip_bufnum_t bufnum, unsigned int length)
 Deallocate the current buffer, and allocate a new buffer.
void fip_packet_activeQueuePacket (void)
 Push the active packet into the queue if supported, if not supported this just frees the packet.
fip_return_t fip_packet_activeUnqueuePacket (void)
 If current packet is PS_UNUSED, swap it with something else.
unsigned int fip_packet_getBufSizes (fip_bufnum_t first, fip_bufnum_t last)
 Returns the total size of all buffers specified, starting at 'first' up to but NOT INCLUDING 'last'.
fip_return_t fip_packet_ptrBufCpyFromActive (fip_packet_t *packetPtr, unsigned int destOffset, uint8_t *srcData, unsigned int dataLen)
 Copy srcLen bytes from srcData to the FIP_IPHDRBUF of fragLocation offset from the start, extending the buffer if required to fit the data in.
void fip_packet_copyToIP6Hdr_destAddr (const uint8_t *const address)
 Copies 16 bytes from the pointer to the IPv6 Destination Address and resets all associated flags containing attributes about the address.
void fip_packet_copyToIP6Hdr_srcAddr (const uint8_t *const address)
 Copies 16 bytes from the pointer to the IPv6 Source Address and resets all associated flags containing attributes about the address .
void fip_packet_setToIP6Hdr_srcAddrUnspecified (void)
 Sets the IPv6 Source Address as the Unspecified Address.
void fip_packet_setToIP6Hdr_destAddrAllNodes (void)
 Sets the IPv6 Destination Address as the All Nodes Address.
void fip_packet_setToIP6Hdr_destAddrAllRouters (void)
 Sets the IPv6 Destination Address as the All Routers Address.


Detailed Description

Header for Active Packet Interface.

Author:
Colin O'Flynn

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