src/stack/ipv6/ipv6.c File Reference

The file has functions which handle the IPv6 Protocol. More...


Functions

UINT16 IPv6Layer4ComputeChecksum (UINT8 *ptr_l4Hdr, PSEUDOV6 *ptr_pseudoHdr)
void IPv6IPAddressToString (IP6N address, char *strIPAddress)
void IPv6DisplayIPAddress (IP6N address)
int isValidHexDigit (int ch)
int GetHexValue (int ch)
int IPv6StringToIPAddress (char *StringIP, IP6N *address)
UINT16 IPv6CompareAddress (IP6N addr1, IP6N addr2)
UINT16 IPv6IsMulticast (IP6N address)
UINT16 IPv6IsLinkLocal (IP6N address)
void IPv6GetSubnetMaskFromBits (IP6N *SubnetMask, UINT16 bits)
int IPv6AddAddress (UINT16 dev_index, IP6N Address, UINT16 NetBits, UINT32 ValidLifetime, UINT32 PrefLifetime, UINT8 IsAnycast)
int IPv6DelAddress (UINT16 dev_index, IP6N Address)
int IPv6InterfaceInit (UINT16 dev_index, void(*DADStatus)(IP6N Address, UINT16 dev_index, UINT8 Status))
int IPv6InterfaceDeInit (UINT16 dev_index)
void IPv6Init (void)


Detailed Description

The file has functions which handle the IPv6 Protocol.

NOTE: (C) Copyright 2008, Texas Instruments, Inc.

Function Documentation

int GetHexValue ( int  ch  ) 

Description
Utility function that converts a given ASCII character to its hexadecimal value.

Parameters:
[in] ch The character that needs to be converted to hex.
Return values:
Hex equivalent - Success
-1 - Error, the character is not a valid hexadecimal digit.

int IPv6AddAddress ( UINT16  dev_index,
IP6N  Address,
UINT16  NetBits,
UINT32  ValidLifetime,
UINT32  PrefLifetime,
UINT8  IsAnycast 
)

Description
This function is used to add an IPv6 address to an interface. This function should not be used to add Link Local Addresses to the interface. Link Local Addresses are automatically added to the interface when the IPv6 stack is initialized on it.

See also:
IPv6AddAddress
The function is exported to system developers and should only be called from outside kernel mode.

Parameters:
[in] dev_index The device index on which the IPv6 address needs to be added.
[in] Address The IPv6 Address which needs to be added.
[in] NetBits The number of bits which make the Subnet-Mask.
[in] ValidLifetime The Valid Lifetime of the address. Set to INFINITE_LT if the address is permanent
[in] PrefLifetime The Preferred Lifetime of the address. Set to INFINITE_LT if the address is permanent.
[in] IsAnycast Flag which indicates if the address to be added is ANYCAST or UNICAST. Set to 1 for ANYCAST.
Return values:
0 - Success
<0 - Error

UINT16 IPv6CompareAddress ( IP6N  addr1,
IP6N  addr2 
)

Description
Utility Function used to compare the 2 IPv6 Addresses.

This is for *internal* NDK Stack Usage.

Parameters:
[in] addr1 The first IPv6 Address which is to be compared.
[in] addr2 The second IPv6 Address which is to be compared.
Return values:
1 - The IP Addresses match
0 - The IP Addresses do not match

int IPv6DelAddress ( UINT16  dev_index,
IP6N  Address 
)

Description
This function is used to delete an IPv6 address from an interface This function should not be used to delete Link Local Addresses from the interface. Link Local Addresses are automatically deleted from the interface when the IPv6 stack is de-initialized on it.

See also:
IPv6InterfaceDeInit
The function is exported to system developers and should only be called from outside kernel mode.

Parameters:
[in] dev_index The device index on which the IPv6 address needs to be deleted.
[in] Address The IPv6 Address which needs to be deleted.
Return values:
0 - Success
<0 - Error

void IPv6DisplayIPAddress ( IP6N  address  ) 

Description
Utility Function which prints the IPv6 address. The IP address passed has to be specified in network order (IP6N).

Parameters:
[in] address IPv6 Address to be displayed.
Return values:
Not Applicable.

void IPv6GetSubnetMaskFromBits ( IP6N *  SubnetMask,
UINT16  bits 
)

Description
Utility Function which gets the subnet mask given the number of bits.

For example: Subnet Mask = 0xFFFF:: if the bits is 16

This is for *internal* NDK Stack Usage.

Parameters:
[out] SubnetMask Pointer to the computed subnet mask in network order.
[in] bits Number of bits in the subnet mask
Return values:
Not Applicable.

void IPv6Init ( void   ) 

Description
This function is used to initialize the IPv6 Module.

This is for *internal* NDK Stack Usage.

Return values:
Not Applicable.

int IPv6InterfaceDeInit ( UINT16  dev_index  ) 

Description
This function is used to deinitialize the IPv6 stack on the the specific device name. The function is available to System Developers and should only be called from within kernel mode.

Parameters:
[in] dev_index The device index on which the IPv6 stack is to be deinitialized.
Return values:
0 - Success
<0 - Error

int IPv6InterfaceInit ( UINT16  dev_index,
void(*)(IP6N Address, UINT16 dev_index, UINT8 Status)  DADStatus 
)

Description
This function is used to initialize the IPv6 stack on the the specific device name. This is available to System Developers and should be invoked for the IPv6 stack to be operational on the specified interface. This can be called only from kernel mode thus System Developers should ensure that is called within the llEnter and llExit sections.

Parameters:
[in] dev_index The device index on which the IPv6 stack is to be initialized.
[in] DADStatus This is the call back function which is invoked by the IPv6 state machine once the DAD process has been completed on an address. The Status argument indicates the result of the DAD operation. 1 indicates that the address was permanent and 0 indicates that the address is a duplicate. This is an optional parameter and can be passed as NULL.
Return values:
0 - Success
<0 - Error

void IPv6IPAddressToString ( IP6N  address,
char *  strIPAddress 
)

Description
Utility Function which converts the IPv6 address to string format.

Parameters:
[in] address The IPv6 Address in IP6N format.
[out] strIPAddress The IPv6 Address in String Format.
Return values:
Not Applicable.

UINT16 IPv6IsLinkLocal ( IP6N  address  ) 

Description
Utility Function which determines if the IPv6 Address specified is a Link Local address or not?

This is for *internal* NDK Stack Usage.

Parameters:
[in] address IPv6 Address which needs to be verfied.
Return values:
1 - The address passed is Link Local
0 - The address passed is NOT Link Local

UINT16 IPv6IsMulticast ( IP6N  address  ) 

Description
Utility Function which determines if the IPv6 Address specified is a Multicast address or not?

This is for *internal* NDK Stack Usage.

Parameters:
[in] address IPv6 Address which needs to be verfied.
Return values:
1 - The address passed is MULTICAST
0 - The address passed is NOT Multicast

UINT16 IPv6Layer4ComputeChecksum ( UINT8 *  ptr_l4Hdr,
PSEUDOV6 *  ptr_pseudoHdr 
)

Description
The function does the Layer4 Checksum computation.

Parameters:
[in] ptr_l4Hdr Pointer to the Layer4 Header. This could be TCP, UDP or ICMPv6.
[in] ptr_pseudoHdr Pointer to the Pseudo Header.
Return values:
Returns the computed checksum.
Precondition:
Ensure that the Checksum field in the layer4 header is set to 0 before calling this function.

int IPv6StringToIPAddress ( char *  StringIP,
IP6N *  address 
)

Description
Utility Function which converts an IPv6 Address from CHAR Format to IP6N

Parameters:
[in] StringIP The IPv6 Address in String Format
[out] address The IPv6 Address in IP6N format.
Return values:
0 - Success
-1 - Error

int isValidHexDigit ( int  ch  ) 

Description
Utility Function that validates whether a given ASCII character is a valid hexadecimal digit.

Parameters:
[in] ch The character that needs to be validated
Return values:
1 - Success, the character is a hexadecimal digit
0 - Error, the character is not a valid hexadecimal digit.


Copyright 2009, Texas Instruments Incorporated