2.9 TCPIP Lite Driver Library

2.9.1 Introduction

The TCPIP-Lite Library for MCC Melody enables the development of TCPIP-Lite applications on 8-bit microcontrollers. This library facilitates quick and easy configuration and code generation of all the available protocols in the latest TCP/IP Lite stack.

2.9.2 Module Documentation

2.9.2.1 ARP

This header file provides the API for the ARPv4 protocol.

2.9.2.1.1 Module description

This header file provides the API for the ARPv4 protocol.

Version: TCP/IP Lite Driver Version 5.0.0
Data structures
Functions
  • void ARPV4_Init (void)

    Initializes the ARP table.

  • error_msg ARPV4_Packet (void)

    Receives all ARP packets on the network and searches the ARP table for an existing ARP entry. If present, it updates the table. If the ARP packet is for the device and its operation is REQUEST, the function replies with the device MAC address.

  • void ARPV4_Update (void)

    Updates the ARP table at least every 10s to avoid aging.

  • mac48Address_t * ARPV4_Lookup (uint32_t ipAddress)

    Maintains an ARP table which maps hardware address to internet address.

  • error_msg ARPV4_Request (uint32_t destAddress)

    Sends the ARP Request.

2.9.2.1.2 Function Documentation

ARPV4_Init()

void ARPV4_Init (void )

Initializes the ARP table.

Parameters:
None.
Returns:

None.

ARPV4_Lookup()

mac48Address_t* ARPV4_Lookup (uint32_t ipAddress)

Maintains an ARP table which maps hardware address to internet address.

Parameters:
ipAddress

32-bit destination IPv4 address in host order

Returns:

Pointer to the destination MAC address.

ARPV4_Packet()

error_msg ARPV4_Packet (void )

Receives all ARP packets on the network and searches the ARP table for an existing ARP entry. If present, it updates the table. If the ARP packet is for the device and its operation is REQUEST, the function replies with the device MAC address.

Parameters:
None.
Return values:
1

ARP reply sent successfully

!1

ARP reply is not sent or the ARP packet is not destined for the device

ARPV4_Request()

error_msg ARPV4_Request (uint32_t destAddress)

Sends the ARP Request.

Parameters:
destAddress

32-bit destination IPv4 address

Return values:
1

ARP request sent successfully

!1

ARP request failed to send

ARPV4_Update()

void ARPV4_Update (void )

Updates the ARP table at least every 10s to avoid aging.

Parameters:
None.
Returns:

None.

2.9.2.2 DHCP

This file provides the API implementation for the Dynamic Host Configuration Protocol (DHCP) client.

2.9.2.2.1 Module description

This file provides the API implementation for the Dynamic Host Configuration Protocol (DHCP) client.

Version: TCP/IP Lite Driver Version 5.0.0
Enumerations
Functions

2.9.2.2.2 Function Documentation

DHCP_Handler()

void DHCP_Handler (int16_t length)

Receives and processes the DHCP packet.

Parameters:
length

Length of the received DHCP packet

Returns:

None.

DHCP_init()

void DHCP_init (void )

Initializes the DHCP.

Parameters:
None.
Returns:

None.

DHCP_Manage()

void DHCP_Manage (void )

Updates the DHCP status at least every one second.

Parameters:
None.
Returns:

None.

DHCP_WriteZeros()

void DHCP_WriteZeros (uint16_t length)

Writes zeroes for the number of bytes passed.

Parameters:
length

Number of bytes

Returns:

None.

sendDHCPDECLINE()

bool sendDHCPDECLINE (void )

Sends DHCP DECLINE request.

Parameters:
None.
Return values:
True

Request sent successfully

False

Request failed to send

sendDHCPDISCOVER()

bool sendDHCPDISCOVER (void )

Sends the DHCP DISCOVER request.

Parameters:
None.
Return values:
True

Request sent successfully

False

Request failed to send

sendDHCPREQUEST()

bool sendDHCPREQUEST (void )

Sends the DHCP REQUEST request.

Parameters:
None.
Return values:
True

Request sent successfully

False

Request failed to send

sendRequest()

bool sendRequest (dhcp_type type)

Sends a DHCP request.

Parameters:
type

Request type enumerated in dhcp_type

Return values:
True

Request sent successfully

False

Request failed to send

2.9.2.2.3 Enumeration Type Documentation

dhcp_rx_client_state

enum dhcp_rx_client_state

Contains the DCHP RX Client state.

SELECTING
REQUESTING
RENEWLEASE
BOUND
dhcp_timer_client_state

enum dhcp_timer_client_state

Contains the DCHP Timer Client state.

INIT_TIMER
WAITFORTIMER
STARTDISCOVER
STARTREQUEST
dhcp_type

enum dhcp_type

Contains DCHP request types.

DHCP_DISCOVER
DHCP_OFFER
DHCP_REQUEST
DHCP_DECLINE
DHCP_ACK
DHCP_NACK
DHCP_RELEASE
DHCP_INFORM
DHCP_FORCERENEW
DHCP_LEASEQUERY
DHCP_LEASEUNASSIGNED
DHCP_LEASEUNKNOWN
DHCP_LEASEACTIVE
DHCP_BULKLEASEQUERY
DHCP_LEASEQUERYDONE

2.9.2.3 DNS

This file provides the API implementation for the Domain Name System (DNS) client.

2.9.2.3.1 Module description

This file provides the API implementation for the Domain Name System (DNS) client.

Version: TCP/IP Lite Driver Version 5.0.0
Functions
  • static int generateSeed (void)

    Generates the seed.

  • void DNS_Init (void)

    Initializes the DNS table.

  • void DNS_Query (const char *str)

    Searches the DNS server for the IPv4 (type A) addresses of the domain names.

  • void DNS_Handler (int16_t length)

    Receives and processes the DNS packet.

  • uint32_t DNS_Lookup (const char *dns_name)

    Maintains the DNS table and maps Domain names to the Internet address.

  • void DNS_Update (void)

    Updates the DNS table at least every 10s to avoid aging.

2.9.2.3.2 Function Documentation

DNS_Handler()

void DNS_Handler (int16_t length)

Receives and processes the DNS packet.

Parameters:
length

Length of the received DNS packet

Returns:

None.

DNS_Init()

void DNS_Init (void )

Initializes the DNS table.

Parameters:
None.
Returns:

None.

DNS_Lookup()

uint32_t DNS_Lookup (const char * dns_name)

Maintains the DNS table and maps Domain names to the Internet address.

Parameters:
*dns_name

Domain name

Returns:

IPv4 address.

DNS_Query()

void DNS_Query (const char * str)

Searches the DNS server for the IPv4 (type A) addresses of the domain names.

Parameters:
*str

Domain name

Returns:

None.

DNS_Update()

void DNS_Update (void )

Updates the DNS table at least every 10s to avoid aging.

Parameters:
None.
Returns:

None.

generateSeed()

static int generateSeed (void )[static]

Generates the seed.

Parameters:
None.
Returns:

Generated DNS seed.

2.9.2.4 ICMP

This file provides the API implementation for the Internet Control Message Protocol (ICMP).

2.9.2.4.1 Module description

This file provides the API implementation for the Internet Control Message Protocol (ICMP).

Version: TCP/IP Lite Driver Version 5.0.0
Functions

2.9.2.4.2 Function Documentation

ICMP_EchoReply()

error_msg ICMP_EchoReply (ipv4Header_t * ipv4Hdr)

Sends an Echo Reply packet to the destination.

Parameters:
*ipv4_hdr

IPv4 header of the received packet

Returns:

Error status. Refer to the error description in tcpip_types.h.

ICMP_PortUnreachable()

error_msg ICMP_PortUnreachable (uint32_t srcIPAddress, uint32_t destIPAddress, uint16_t length)

Sends Port Unreachable messages to the destination.

Parameters:
srcIPAddress

Source IP address

destIPAddress

Destination IP address

length

Length of the IP datagram

Returns:

Error status. Refer to the error description in tcpip_types.h.

ICMP_Receive()

error_msg ICMP_Receive (ipv4Header_t * ipv4Hdr)

Receives the ICMP packet. This function processes only Echo Request messages.

Parameters:
*ipv4_hdr

IPv4 header of the received packet

Return values:
1

ICMP packet received

!1

ICMP packet not received

isPortUnreachable()

bool isPortUnreachable (uint16_t port)

Checks if the Port Unreachable flag is set to the port number of the application.

Parameters:
port

Port number of the application

Return values:
True

The port is unreachable

False

The port is reachable

resetPortUnreachable()

void resetPortUnreachable (void )

Resets the Port Unreachable flag to zero.

Parameters:
None.
Returns:

None.

2.9.2.5 IPV4

This file provides the API implementation for the Internet Protocol v4 (IPv4).

2.9.2.5.1 Module description

This file provides the API implementation for the Internet Protocol v4 (IPv4).

Version: TCP/IP Lite Driver Version 5.0.0
Data structures
Functions
  • void ipdb_init (void)

    Initializes the IP database.

  • uint32_t makeStrToIpv4Address (char *str)

    Converts a string into a 32-bit IPv4 address.

  • char * makeIpv4AddresstoStr (uint32_t addr)

    Converts an IPv4 address into a string.

  • void TCP_Recv (uint32_t remoteAddress, uint16_t length)

    Receives TCP packets.

  • static uint8_t getHeaderLen (void)

    Returns the header length.

  • error_msg IPV4_Packet (void)

    Receives the IPv4 packet. This function reads the IPv4 header and filters the upper layer protocols.

  • error_msg IPv4_Start (uint32_t dstAddress, ipProtocolNumbers protocol)

    Starts the IPv4 packet. This routine starts the Ethernet packet and writes the IPv4 header. Initially Checksum and Payload length are set to '0'. An error code is returned if there has been an error in accepting, or if something goes wrong.

  • uint16_t IPV4_PseudoHeaderChecksum (uint16_t payloadLen)

    Computes the pseudo-header checksum for transport layer protocols.

  • error_msg IPV4_Send (uint16_t payloadLength)

    Sends the IPv4 packet. This function inserts the total length of IPv4 packet, computes and adds the Ipv4 header checksum.

  • uint16_t IPV4_GetDatagramLength (void)

    Returns the length of the IPv4 datagram.

2.9.2.5.2 Function Documentation

getHeaderLen()

static uint8_t getHeaderLen (void )[static]

Returns the header length.

Parameters:
None.
Returns:

Length of the header.

ipdb_init()

void ipdb_init (void )

Initializes the IP database.

Parameters:
None.
Returns:

None.

IPV4_GetDatagramLength()

uint16_t IPV4_GetDatagramLength (void )

Returns the length of the IPv4 datagram.

Parameters:
None.
Returns:

Length of IPV4 datagram.

IPV4_Packet()

error_msg IPV4_Packet (void )

Receives the IPv4 packet. This function reads the IPv4 header and filters the upper layer protocols.

Parameters:
None.
Returns:

Error status. Refer to the error description in tcpip_types.h.

IPV4_PseudoHeaderChecksum()

uint16_t IPV4_PseudoHeaderChecksum (uint16_t payloadLen)

Computes the pseudo-header checksum for transport layer protocols.

Parameters:
payloadLen

Length of the transport layer packet

Returns:

Checksum.

IPV4_Send()

error_msg IPV4_Send (uint16_t payloadLength)

Sends the IPv4 packet. This function inserts the total length of IPv4 packet, computes and adds the Ipv4 header checksum.

Parameters:
payloadLength

Data length of the transport packet

Return values:
1

IP packet was sent successfully

!1

IP packet was not sent

IPv4_Start()

error_msg IPv4_Start (uint32_t dstAddress, ipProtocolNumbers protocol)

Starts the IPv4 packet. This routine starts the Ethernet packet and writes the IPv4 header. Initially Checksum and Payload length are set to '0'. An error code is returned if there has been an error in accepting, or if something goes wrong.

Parameters:
dstAddress

32-bit destination Ipv4 address

protocol

Protocol number

Returns:

Error status. Refer to the error description in tcpip_types.h.

makeIpv4AddresstoStr()

char* makeIpv4AddresstoStr (uint32_t addr)

Converts an IPv4 address into a string.

Parameters:
addr

32-bit IPV4 address

Returns:

IPV4 address in a string format.

makeStrToIpv4Address()

uint32_t makeStrToIpv4Address (char * str)

Converts a string into a 32-bit IPv4 address.

Parameters:
*str

IPv4 address in a string format

Returns:

IPv4 address.

TCP_Recv()

void TCP_Recv (uint32_t remoteAddress, uint16_t length)

Receives TCP packets.

Parameters:
remoteAddress

Address of the remote device

length

Packet length

Returns:

None.

Receives TCP packets.

Parameters:
remoteAddress

Source IP address for the received TCP packet

length

Length of the TCP payload

Returns:

None.

2.9.2.6 LLDP

This file provides the API implementation of the Link Layer Discovery Protocol (LLDP).

2.9.2.6.1 Module description

This file provides the API implementation of the Link Layer Discovery Protocol (LLDP).

Version: TCP/IP Lite Driver Version 5.0.0
Enumerations
Functions

2.9.2.6.2 Function Documentation

get_org_tlvs_table_size()

uint8_t get_org_tlvs_table_size (void )

Gets the size of the table that stores Organizationally Specific TLVs.

Parameters:
None.
Returns:

Table size

LLDP_DecTTR()

void LLDP_DecTTR (void )

Decreases the LLDP TX timer value.

Parameters:
None.
Returns:

None.

LLDP_GetAllocatedPower()

uint16_t LLDP_GetAllocatedPower (void )

Gets the LLDP allocated power.

Parameters:
None.
Returns:

Allocated power.

LLDP_getAssetID()

char* LLDP_getAssetID (void )

Gets the LLDP asset ID.

Parameters:
None.
Returns:

Asset ID.

LLDP_getFirmwareRevision()

char* LLDP_getFirmwareRevision (void )

Gets the LLDP firmware revision.

Parameters:
None.
Returns:

Firmware revision.

LLDP_getHardwareRevision()

char* LLDP_getHardwareRevision (void )

Gets the LLDP hardware revision.

Parameters:
None.
Returns:

Hardware revision.

LLDP_getInfo()

char* LLDP_getInfo (char * Name)

Gets the LLDP information.

Parameters:
*Name

Name of port

Returns:

Port description.

LLDP_getManufacturer()

char* LLDP_getManufacturer (void )

Gets the LLDP manufacturer.

Parameters:
None.
Returns:

Manufacturer.

LLDP_getModelName()

char* LLDP_getModelName (void )

Gets the LLDP module name.

Parameters:
None.
Returns:

Module name.

LLDP_getPortDescription()

char* LLDP_getPortDescription (void )

Gets the LLDP port description.

Parameters:
None.
Returns:

Port description.

LLDP_getSerialNumber()

char* LLDP_getSerialNumber (void )

Gets the LLDP serial number.

Parameters:
None.
Returns:

Serial number.

LLDP_getSoftwareRevision()

char* LLDP_getSoftwareRevision (void )

Gets the LLDP software revision.

Parameters:
None.
Returns:

Software revision.

LLDP_InitRx()

void LLDP_InitRx (void )

Initializes the LLDP RX.

Parameters:
None.
Returns:

None.

LLDP_InitRxTx()

void LLDP_InitRxTx (void )

Initializes the LLDP RX and TX.

Parameters:
None.
Returns:

None.

LLDP_InitTx()

void LLDP_InitTx (void )

Initializes the LLDP TX.

Parameters:
None.
Returns:

None.

LLDP_Packet()

void LLDP_Packet (void )

Processes LLDP packets.

Parameters:
None.
Returns:

None.

LLDP_Run()

void LLDP_Run (void )

Runs the LLDP.

Parameters:
None.
Returns:

None.

LLDP_setAssetID()

void LLDP_setAssetID (const char * val)

Sets the LLDP asset ID.

Parameters:
*val

Asset ID

Returns:

None.

LLDP_SetDesiredPower()

void LLDP_SetDesiredPower (uint16_t pwr)

Sets the LLDP desired power.

Parameters:
pwr

Desired power

Returns:

None.

LLDP_SetDestAddress()

MulticastMacAddr LLDP_SetDestAddress (void )

Sets the LLDP destination address.

Parameters:
None.
Returns:

Multicast MAC Address.

LLDP_setFirmwareRevision()

void LLDP_setFirmwareRevision (const char * val)

Sets the LLDP firmware revision.

Parameters:
*val

Firmware revision

Returns:

None.

LLDP_setHardwareRevision()

void LLDP_setHardwareRevision (const char * val)

Sets the LLDP hardware revision.

Parameters:
*val

Hardware revision

Returns:

None.

LLDP_setManufacturer()

void LLDP_setManufacturer (const char * val)

Sets the LLDP manufacturer.

Parameters:
*val

- Manufacturer

Returns:

None.

LLDP_setModelName()

void LLDP_setModelName (const char * val)

Sets the LLDP module name.

Parameters:
*val

Module name

Returns:

None.

LLDP_setMUDInfo()

void LLDP_setMUDInfo (const char * val)

Sets the LLDP Manufacturer Usage Description (MUD) information.

Parameters:
*val

MUD information

Returns:

None.

LLDP_setPortDescription()

void LLDP_setPortDescription (const char * val)

Sets the LLDP port description.

Parameters:
*val

Port description

Returns:

None.

LLDP_setSerialNumber()

void LLDP_setSerialNumber (const char * val)

Sets the LLDP serial number.

Parameters:
*val

Serial number

Returns:

None.

LLDP_setSoftwareRevision()

void LLDP_setSoftwareRevision (const char * val)

Sets the LLDP software revision.

Parameters:
*val

Software revision

Returns:

None.

2.9.2.6.3 Enumeration Type Documentation

CHASSIS_SUBTYPE

enum CHASSIS_SUBTYPE

TLV subtypes from section 9 of IEEE 802.1AB.

CHASSIS_COMPONENT
CHASSIS_INTERFACE_ALIAS
CHASSIS_PORT_COMPONENT
CHASSIS_MAC_ADDRESS
CHASSIS_NETWORK_ADDRESS
CHASSIS_INTERFACE_NAME
CHASSIS_LOCALLY_ASSIGNED
lldp_admin_status

enum lldp_admin_status

Contains the LLDP admin status.

disabled
enabledTxOnly
enabledRxOnly
enabledRxTx
lldp_rxStates_t

enum lldp_rxStates_t

LLDP RX states.

LLDP_WAIT_PORT_OPERATIONAL
RX_LLDP_INITIALIZE
RX_WAIT_FOR_FRAME
RX_FRAME
lldp_txStates_t

enum lldp_txStates_t

LLDP TX states.

TX_LLDP_INITIALIZE
TX_IDLE
TX_INFO_FRAME
TX_SHUTDOWN_FRAME
lldp_txTimerStates_t

enum lldp_txTimerStates_t

LLDP TX Timer states.

TX_TIMER_INITIALIZE
TX_TIMER_IDLE
TX_TIMER_EXPIRES
TX_TICK
SIGNAL_TX
TX_FAST_START
ORG_CISCO_SUBTYPE

enum ORG_CISCO_SUBTYPE

Organizationally Specific TLVs from section 79.3 of IEEE 802.3.

res2
CISCO_POWER_VIA_MDI
CISCO_OUI_TLV
CISCO_CLASS_TLV
CISCO_PROTOCOL_TLV
ORG_IEEE_3_SUBTYPE

enum ORG_IEEE_3_SUBTYPE

Organizationally Specific TLVs from section 79.3 of IEEE 802.3.

res
IEEE_3_MAC_PHY_CONFIG
IEEE_3_POWER_VIA_MDI
IEEE_3_LINK_AGGREGATION

Deprecated

IEEE_3_MAX_FRAME_SIZE
IEEE_3_ENERGY_EFFICIENT_ETHERNET
ORG_MUD_CISCO_SUBTYPE

enum ORG_MUD_CISCO_SUBTYPE

Organizationally Specific TLVs from section 79.3 of IEEE 802.3.

res3
CISCO_MUD_TLV
ORG_TIA_SUBTYPE

enum ORG_TIA_SUBTYPE

Organizationally Specific TLVs from section 10 of ANSI-TIA_1057.

res1
TIA_LLDP_MED
TIA_NETWORK_POLICY
TIA_LOCATION_ID
TIA_EXTENDED_POWER_VIA_MDI
TIA_INVENT_HW_REV
TIA_INVENT_FW_REV
TIA_INVENT_SW_REV
TIA_INVENT_SERIAL_NUM
TIA_INVENT_MANUFACT_NAME
TIA_INVENT_MODEL_NAME
TIA_INVENT_ASSET_ID
PORT_SUBTYPE

enum PORT_SUBTYPE

TLV subtypes from section 9 of IEEE 802.1AB.

reserved
PORT_INTERFACE_ALIAS
PORT_COMPONENT
PORT_MAC_ADDRESS
PORT_NETWORK_ADDRESS
PORT_INTERFACE_NAME
PORT_AGENT_CIRCUIT_ID
PORT_LOCALLY_ASSIGNED
TLV_TYPES

enum TLV_TYPES

Mandatory and optional TLV types from IEEE 802.1AB.

END_LLDPDU_TLV

Mandatory

CHASSIS_ID_TLV

Mandatory

PORT_ID_TLV

Mandatory

TIME_TO_LIVE_TLV

Mandatory

PORT_DESCRIPTION_TLV

Optional

SYSTEM_NAME_TLV

Optional

SYSTEM_DESCRIPTION_TLV

Optional

SYSTEM_CAPABILITIES_TLV

Optional

MANAGEMENT_ADDRESS_TLV

Optional

ORG_SPECIFIC_TLV

Optional

2.9.2.7 NTP

This file provides the API implementation for the Network Time Protocol (NTP) client.

2.9.2.7.1 Module description

This file provides the API implementation for the Network Time Protocol (NTP) client.

Version: TCP/IP Lite Driver Version 5.0.0
Definitions
  • #define NTP_TIME_OFFSET 2208988800

    The time offset converts from unix time (seconds, since January 1, 1970) to RFC 868 time (seconds, since January 1, 1900). The RFC indicates that this is sufficient until 2036.

Functions
  • void NTP_Request (void)

    Sends the NTP request to the NTP server.

  • void NTP_Handler (int16_t length)

    Receives and processes the NTP packet.

2.9.2.7.2 Definition Documentation

NTP_TIME_OFFSET

#define NTP_TIME_OFFSET 2208988800

The time offset converts from unix time (seconds, since January 1, 1970) to RFC 868 time (seconds, since January 1, 1900). The RFC indicates that this is sufficient until 2036.

2.9.2.7.3 Function Documentation

NTP_Handler()

void NTP_Handler (int16_t length)

Receives and processes the NTP packet.

Parameters:
length

Length of the received NTP packet

Returns:

None.

NTP_Request()

void NTP_Request (void )

Sends the NTP request to the NTP server.

Parameters:
None.
Returns:

None.

2.9.2.8 TCP

This file provides the API implementation for the Transmission Control Protocol v4 (TCPv4).

2.9.2.8.1 Module description

This file provides the API implementation for the Transmission Control Protocol v4 (TCPv4).

Version: TCP/IP Lite Driver Version 5.0.0
Data structures
  • struct tcpTCB_t

    Defines TCP Transmission Control Block.

Enumerations
Functions
  • static error_msg TCP_FiniteStateMachine (void)

    TCP stack state machine called upon the occurrence of each event (e.g., opening/closing a connection, receiving a TCP packet).

  • static error_msg TCP_TimoutRetransmit (void)

    Retransmits TCP packets after timeout.

  • static void TCB_Insert (tcpTCB_t *ptr)

    Inserts a pointer to the new TCB into the TCB pointer list.

  • static void TCB_Remove (tcpTCB_t *ptr)

    Removes a pointer to a TCB from the TCB pointer list and connects its adjacent items together.

  • static void TCB_Reset (tcpTCB_t *tcbPtr)

    Resets the socket to a known state.

  • static error_msg TCB_Check (tcpTCB_t *ptr)

    Check if there is a pointer to a socket/TCB. If the pointer is in the TCB list, then it is a valid socket.

  • static error_msg TCP_Snd (tcpTCB_t *tcbPtr)

    Internal function of the TCP stack to send a TCP packet.

  • error_msg TCP_PayloadSave (uint16_t len)

    Copies the TCP packet payload to the socket RX buffer. This routine also sends the ACK for the received packet and any data ready to be sent.

  • static error_msg TCP_ParseTCPOptions (void)

    Reads and parses the Options field in the TCP header. This routine reads only the ones that have SYN or SYN + ACK. For the other TCP headers the field will be skipped.

  • void TCP_Recv (uint32_t remoteAddress, uint16_t length)

    Identifies the destination socket and parses the TCP header. This routine is called by the IP layer for each received TCP packet.

  • void TCP_Init (void)

    Initializes TCP structures, meaning certain internal TCP stack variables.

  • error_msg TCP_SocketInit (tcpTCB_t *tcbPtr)

    Initializes the TCB and adds it to the list of TCB pointers. The socket needs to be put in the Closed state. The user is responsible to manage memory allocation and release.

  • error_msg TCP_SocketRemove (tcpTCB_t *tcbPtr)

    Removes the socket pointer from the TCP stack, and the list of TCB pointers, respectively. After calling this routine the memory is ready to be used again.

  • socketState_t TCP_SocketPoll (tcpTCB_t *socket_ptr)

    Provides an interface to read the status of the socket. This routine also checks if the pointer is already in the TCB list. This means that the socket is "in use". If the socket is in the TCB list, the socket status will be returned.

  • error_msg TCP_Bind (tcpTCB_t *tcbPtr, uint16_t port)

    Assigns a port number to the specified socket. This is used for configuring the local port of a socket.

  • error_msg TCP_Listen (tcpTCB_t *tcbPtr)

    Listens for connections on a socket. This routine marks the socket as passive, meaning that it will be used to accept incoming connection requests.

  • error_msg TCP_Connect (tcpTCB_t *tcbPtr, sockaddr_in4_t *srvaddr)

    Starts the client for a particular socket.

  • error_msg TCP_Close (tcpTCB_t *tcbPtr)

    Closes the TCP connection. This initiates the closing sequence for the TCP connection.

  • error_msg TCP_Send (tcpTCB_t *tcbPtr, uint8_t *data, uint16_t dataLen)

    Sends a buffer to a remote machine using a TCP connection. This routine adds the buffer to the socket and the payload is sent as soon as possible.

  • error_msg TCP_SendDone (tcpTCB_t *tcbPtr)

    Checks if the TX buffer was sent. This means that the data was received correctly by the remote machine and the TX buffer memory can be reused by the application.

  • error_msg TCP_InsertRxBuffer (tcpTCB_t *tcbPtr, uint8_t *data, uint16_t data_len)

    Adds the RX buffer to the socket.

  • int16_t TCP_GetReceivedData (tcpTCB_t *tcbPtr)

    Reads the available data from the socket. This routine provides the start address of the received buffer to the user.

  • int16_t TCP_GetRxLength (tcpTCB_t *tcbPtr)

    Checks and returns the number of available bytes received on a socket.

  • void TCP_Update (void)

    Handles the TCP stack time-outs for each available socket. This routine needs to be called periodically.

2.9.2.8.2 Function Documentation

TCB_Check()

static error_msg TCB_Check (tcpTCB_t * ptr)[static]

Check if there is a pointer to a socket/TCB. If the pointer is in the TCB list, then it is a valid socket.

Parameters:
*ptr

Pointer to the socket/TCB structure

Returns:

Error status. Refer to the error description in tcpip_types.h.

TCB_Insert()

static void TCB_Insert (tcpTCB_t * ptr)[static]

Inserts a pointer to the new TCB into the TCB pointer list.

Parameters:
*ptr

Pointer to the user-allocated memory for the TCB structure

Returns:

None.

TCB_Remove()

static void TCB_Remove (tcpTCB_t * ptr)[static]

Removes a pointer to a TCB from the TCB pointer list and connects its adjacent items together.

Parameters:
*ptr

Pointer to the user-allocated memory for the TCB structure

Returns:

None.

TCB_Reset()

static void TCB_Reset (tcpTCB_t * tcbPtr)[static]

Resets the socket to a known state.

Parameters:
*tcbPtr

Pointer to the socket/TCB structure

Returns:

None.

TCP_Bind()

error_msg TCP_Bind (tcpTCB_t * tcbPtr, uint16_t port)

Assigns a port number to the specified socket. This is used for configuring the local port of a socket.

Parameters:
*tcbPtr

Pointer to the socket/TCB structure

port

Port number to be used as a local port

Return values:
True

The port initialization succeeded

False

The port initialization failed

TCP_Close()

error_msg TCP_Close (tcpTCB_t * tcbPtr)

Closes the TCP connection. This initiates the closing sequence for the TCP connection.

Parameters:
*tcbPtr

Pointer to the socket/TCB structure

Return values:
True

The closing sequence was initialized

False

The closing sequence was not initialized

TCP_Connect()

error_msg TCP_Connect (tcpTCB_t * tcbPtr, sockaddr_in4_t * srvaddr)

Starts the client for a particular socket.

Parameters:
*tcbPtr

Pointer to the socket/TCB structure

*srvaddr

Pointer to the server address

Return values:
True

Starting the server succeeded

False

Starting the server failed

TCP_FiniteStateMachine()

static error_msg TCP_FiniteStateMachine (void )[static]

TCP stack state machine called upon the occurrence of each event (e.g., opening/closing a connection, receiving a TCP packet).

Parameters:
None.
Returns:

Error status. Refer to the error description in tcpip_types.h.

TCP_GetReceivedData()

int16_t TCP_GetReceivedData (tcpTCB_t * tcbPtr)

Reads the available data from the socket. This routine provides the start address of the received buffer to the user.

Parameters:
*tcbPtr

Pointer to the socket/TCB structure

Returns:

Number of received bytes in the buffer.

TCP_GetRxLength()

int16_t TCP_GetRxLength (tcpTCB_t * tcbPtr)

Checks and returns the number of available bytes received on a socket.

Parameters:
*tcbPtr

Pointer to the socket/TCB structure

Returns:

Number of received bytes in the buffer.

TCP_Init()

void TCP_Init (void )

Initializes TCP structures, meaning certain internal TCP stack variables.

Parameters:
None.
Returns:

None.

TCP_InsertRxBuffer()

error_msg TCP_InsertRxBuffer (tcpTCB_t * tcbPtr, uint8_t * data, uint16_t data_len)

Adds the RX buffer to the socket.

Parameters:
*tcbPtr

Pointer to the socket/TCB structure

*data

Pointer to the data buffer

data_len

Size of the buffer

Return values:
True

Passing the buffer to the socket succeeded

False

Passing the buffer to the socket failed

TCP_Listen()

error_msg TCP_Listen (tcpTCB_t * tcbPtr)

Listens for connections on a socket. This routine marks the socket as passive, meaning that it will be used to accept incoming connection requests.

Parameters:
*tcbPtr

Pointer to the socket/TCB structure

Return values:
True

Starting the server succeeded

False

Starting the server failed

TCP_ParseTCPOptions()

static error_msg TCP_ParseTCPOptions (void )[static]

Reads and parses the Options field in the TCP header. This routine reads only the ones that have SYN or SYN + ACK. For the other TCP headers the field will be skipped.

Parameters:
None.
Return values:
True

Parsing the Options field succeeded

False

Parsing the Options field failed

TCP_PayloadSave()

error_msg TCP_PayloadSave (uint16_t len)

Copies the TCP packet payload to the socket RX buffer. This routine also sends the ACK for the received packet and any data ready to be sent.

Parameters:
len

Length of the payload received

Return values:
True

Copying the payload to the RX buffer succeeded

False

Copying the payload to the RX buffer failed

TCP_Recv()

void TCP_Recv (uint32_t remoteAddress, uint16_t length)

Identifies the destination socket and parses the TCP header. This routine is called by the IP layer for each received TCP packet.

Receives TCP packets.

Parameters:
remoteAddress

Source IP address for the received TCP packet

length

Length of the TCP payload

Returns:

None.

TCP_Send()

error_msg TCP_Send (tcpTCB_t * tcbPtr, uint8_t * data, uint16_t dataLen)

Sends a buffer to a remote machine using a TCP connection. This routine adds the buffer to the socket and the payload is sent as soon as possible.

Parameters:
*tcbPtr

Pointer to the socket/TCB structure

*data

Pointer to the data buffer

dataLen

Size of the buffer

Return values:
True

Adding the buffer to the socket/TCB succeeded

False

Adding the buffer to the socket/TCB failed

TCP_SendDone()

error_msg TCP_SendDone (tcpTCB_t * tcbPtr)

Checks if the TX buffer was sent. This means that the data was received correctly by the remote machine and the TX buffer memory can be reused by the application.

Parameters:
*tcbPtr

Pointer to the socket/TCB structure

Return values:
True

Buffer transmission succeeded

False

Buffer transmission failed or was not yet started

TCP_Snd()

static error_msg TCP_Snd (tcpTCB_t * tcbPtr)[static]

Internal function of the TCP stack to send a TCP packet.

Parameters:
*tcbPtr

Pointer to the socket/TCB structure

Return values:
True

Sending the buffer succeeded

False

Sending the buffer failed

TCP_SocketInit()

error_msg TCP_SocketInit (tcpTCB_t * tcbPtr)

Initializes the TCB and adds it to the list of TCB pointers. The socket needs to be put in the Closed state. The user is responsible to manage memory allocation and release.

Parameters:
*tcbPtr

Pointer to the socket/TCB structure

Return values:
-1

The insertion failed

0

The insertion succeeded

TCP_SocketPoll()

socketState_t TCP_SocketPoll (tcpTCB_t * socket_ptr)

Provides an interface to read the status of the socket. This routine also checks if the pointer is already in the TCB list. This means that the socket is "in use". If the socket is in the TCB list, the socket status will be returned.

Parameters:
*socket_ptr

Pointer to the socket/TCB structure

Returns:

Socket status.

TCP_SocketRemove()

error_msg TCP_SocketRemove (tcpTCB_t * tcbPtr)

Removes the socket pointer from the TCP stack, and the list of TCB pointers, respectively. After calling this routine the memory is ready to be used again.

Parameters:
*tcbPtr

Pointer to the socket/TCB structure

Return values:
-1

Removing the socket failed

0

Removing the socket succeeded

TCP_TimoutRetransmit()

static error_msg TCP_TimoutRetransmit (void )[static]

Retransmits TCP packets after timeout.

Parameters:
None.
Returns:

Error status. Refer to the error description in tcpip_types.h.

TCP_Update()

void TCP_Update (void )

Handles the TCP stack time-outs for each available socket. This routine needs to be called periodically.

Parameters:
None.
Returns:

None.

2.9.2.8.3 Enumeration Type Documentation

socketState_t

enum socketState_t

Socket states to be used in the application.

NOT_A_SOCKET

This is not a socket

SOCKET_CLOSED

Socket closed

SOCKET_IN_PROGRESS

The TCP listens or initiates a connection

SOCKET_CONNECTED

The TCP is in the established state and the user can send/receive data

SOCKET_CLOSING

The user initiates the closing procedure for this socket

tcp_fsm_states_t

enum tcp_fsm_states_t

TCP Finite State Machine (FSM) states.

CLOSED

Facilitates initialization

LISTEN
SYN_SENT
SYN_RECEIVED
ESTABLISHED
FIN_WAIT_1
FIN_WAIT_2
CLOSE_WAIT
CLOSING
LAST_ACK
TIME_WAIT
tcp_options_t

enum tcp_options_t

TCP options.

TCP_EOP

length = 0 End of Option List, [RFC793]

TCP_NOP

length = 0 No-Operation, [RFC793]

TCP_MSS

length = 4 Maximum Segment Size, [RFC793]

tcpBufferState_t

enum tcpBufferState_t

TCP Buffer state.

NO_BUFF
RX_BUFF_IN_USE
TX_BUFF_IN_USE
tcpEvent_t

enum tcpEvent_t

TCP events.

CLOSE

Facilitates initialization

ACTIVE_OPEN
PASIVE_OPEN
RCV_SYN
RCV_ACK
RCV_SYNACK
RCV_FIN
RCV_FINACK
RX_PACKET
RCV_RST
RCV_RSTACK
RCV_PSHACK
TIMEOUT
NOP

2.9.2.9 TFTP

This file contains the API implementation for the Trivial File Transfer Protocol (TFTP).

2.9.2.9.1 Module description

This file contains the API implementation for the Trivial File Transfer Protocol (TFTP).

Version: TCP/IP Lite Driver Version 5.0.0
Functions
  • void TFTP_Ack (uint8_t opcode)

    Sends an acknowledgement on receiving a packet from a TFTP Server.

  • error_msg TFTP_Read_Write_Request (uint8_t opcode)

    Sends a read or write request to the TFTP server depending on the opcode.

  • void TFTP_Handler (int16_t length)

    Processes a TFTP message as per the opcode in the packet.

  • void Process_TFTP_Data (uint32_t address, char *data, uint16_t length)

    Processes TFTP packets with 'data' opcode and blocks of the specified size. Depending on TFTP_callBackTable, the storage can be in EEPROM, Flash, etc.

  • void TFTP_Configure (uint32_t tftp_server_address, char *tftp_filename, char *tftp_block_size)

    Allows the user to configure the TFTP server options.

2.9.2.9.2 Function Documentation

Process_TFTP_Data()

void Process_TFTP_Data (uint32_t address, char * data, uint16_t length)

Processes TFTP packets with 'data' opcode and blocks of the specified size. Depending on TFTP_callBackTable, the storage can be in EEPROM, Flash, etc.

Parameters:
address

Destination address where the data has to be stored (EEPROM, Flash, etc.)

*data

Actual data in the packet to be programmed

length

Packet length, number of bytes to be programmed

Returns:

None.

TFTP_Ack()

void TFTP_Ack (uint8_t opcode)

Sends an acknowledgement on receiving a packet from a TFTP Server.

Parameters:
opcode

Packet opcode

Returns:

None.

TFTP_Configure()

void TFTP_Configure (uint32_t tftp_server_address, char * tftp_filename, char * tftp_block_size)

Allows the user to configure the TFTP server options.

Parameters:
tftp_server_address

TFTP server address

*tftp_filename

Name of the file to be read from the TFTP server

*tftp_block_size

Size of each packet in bytes sent by the TFTP server

Returns:

None.

TFTP_Handler()

void TFTP_Handler (int16_t length)

Processes a TFTP message as per the opcode in the packet.

Parameters:
length

Packet length

Returns:

None.

TFTP_Read_Write_Request()

error_msg TFTP_Read_Write_Request (uint8_t opcode)

Sends a read or write request to the TFTP server depending on the opcode.

Parameters:
opcode

Packet opcode

Returns:

Status of the read/write request. Refer to the error description in tcpip_types.h.

2.9.2.9.3 Enumeration Type Documentation

tftp_client_state

enum tftp_client_state

TFTP Client state.

tftp_read
tftp_write
tftp_data
tftp_ack
tftp_error
tftp_optack
tftp_opcode

enum tftp_opcode

TFTP opcode.

TFTP_READ_REQUEST
TFTP_WRITE_REQUEST
TFTP_DATA
TFTP_ACK
TFTP_ERROR
TFTP_OPTACK

2.9.2.9.4 Variable Documentation

store_type

store_type = 0

Default storage type for TFTP handler is 0.

2.9.2.10 UDP

This file provides the API implementation for UDP v4.

2.9.2.10.1 Module description

This file provides the API implementation for UDP v4.

Version: TCP/IP Lite Driver Version 5.0.0

2.9.2.10.2 Function Documentation

UDP_Receive()

error_msg UDP_Receive (uint16_t udpcksm)

Catches all UDP packets and dispatches them to the appropriate callback.

Parameters:
udpcksm

UDP Checksum

Returns:

Error status. Refer to the error description in tcpip_types.h.

UDP_Send()

error_msg UDP_Send (void )

Sends a UDP packet.

Parameters:
None.
Returns:

Error status. Refer to the error description in tcpip_types.h.

UDP_Start()

error_msg UDP_Start (uint32_t destIP, uint16_t srcPort, uint16_t dstPort)

Starts a UDP packet.

Parameters:
destIP

Destination IP address

srcPort

Source port

dstPort

Destination port

Returns:

Error status. Refer to the error description in tcpip_types.h.

udp_table_getIterator()

udp_table_iterator_t udp_table_getIterator (void )

Returns the UDP table iterator.

Parameters:
None.
Returns:

Pointer to UDP_CallBackTable.

udp_table_nextEntry()

udp_table_iterator_t udp_table_nextEntry (udp_table_iterator_t i)

Returns the UDP table next entry.

Parameters:
i

UDP table iteration

Returns:

Pointer to UDP_CallBackTable.

2.9.3 Class Documentation

2.9.3.1 arpHeader_t Struct Reference

Contains the ARP information.

2.9.3.1.1 Detailed Description

Contains the ARP information.

2.9.3.1.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

arpv4.c

hlen

uint8_t hlen

Hardware Address Length

htype

uint16_t htype

Hardware Type

oper

uint16_t oper

Operation

plen

uint8_t plen

Protocol Address Length

ptype

uint16_t ptype

Protocol Type

sha

mac48Address_t sha

Sender Hardware Address

spa

uint32_t spa

Sender Protocol Address

tha

mac48Address_t tha

Target Hardware Address

tpa

uint32_t tpa

Target Protocol Address

2.9.3.2 arpMap_t Struct Reference

Contains the ARP database.

2.9.3.2.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

arpv4.c

age

uint8_t age

Replace oldest entry with new data as required.

ipAddress

uint32_t ipAddress

IP address

macAddress

mac48Address_t macAddress

MAC address

protocolType

uint16_t protocolType

Protocol type

2.9.3.3 createBasicTLV_t Struct Reference

Creates a basic Type-Length-Value (TLV).

2.9.3.3.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

lldp.h

buffLength

uint16_t buffLength

callTlvMaker

createBasicFuncPtr callTlvMaker

subtype

uint8_t subtype

tlvOrder

uint8_t tlvOrder

type

uint8_t type

2.9.3.4 createOrgTLV_t Struct Reference

Creates Organizationally Specific TLV.

2.9.3.4.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

lldp.h

buffLength

uint16_t buffLength

callTlvMaker

createOrgFuncPtr callTlvMaker

OUI

uint32_t OUI

Organizationally Unique Identifier

tlvOrder

uint8_t tlvOrder

type

uint8_t type

2.9.3.5 destIP_t Struct Reference

#include <tcpip_types.h>

2.9.3.5.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

tcpip_types.h

dest_addr

inAddr_t dest_addr

2.9.3.6 dhcp_data_t Struct Reference

Contains option data.

2.9.3.6.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

dhcp_client.c

dhcpIPAddress

uint32_t dhcpIPAddress

DHCP IP address

dhcpServerIdentifier

uint32_t dhcpServerIdentifier

DHCP Server ID

dnsAddress

uint32_t dnsAddress[2]

Captures only two DNS addresses

gatewayAddress

uint32_t gatewayAddress

x ID value

ntpAddress

uint32_t ntpAddress[2]

Captures only two DNS addresses

routerAddress

uint32_t routerAddress

Router address

subnetMask

uint32_t subnetMask

Subnet mask

t1

uint32_t t1

Name as per the RFC, page 35

t2

uint32_t t2

Name as per the RFC, page 35  

xidValue

uint32_t xidValue

x ID value

2.9.3.7 dhcp_state_t Struct Reference

Contains state data.

2.9.3.7.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

dhcp_client.c

rxClientState

dhcp_rx_client_state rxClientState

tmrClientState

dhcp_timer_client_state tmrClientState

2.9.3.8 dns_map_t Struct Reference

2.9.3.8.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

dns_client.c

birthSecond

time_t birthSecond

dnsName

const char* dnsName

ipAddress

uint32_t ipAddress

isValid

bool isValid

ttl

uint32_t ttl

2.9.3.9 ethernetFrame_t Struct Reference

Ethernet frame information.

2.9.3.9.1 Detailed Description

Ethernet frame information.

#include <tcpip_types.h>

2.9.3.9.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

tcpip_types.h

destinationMAC

uint8_t destinationMAC[6]

id

union { ... } id

length

uint16_t length

sourceMAC

uint8_t sourceMAC[6]

tpid

uint16_t tpid

type

uint16_t type

Ethernet 2 frame type, 802.3 length, 802.1Q TPID

2.9.3.10 icmpHeader_t Struct Reference

ICMP header information.

2.9.3.10.1 Detailed Description

ICMP header information.

#include <tcpip_types.h>

2.9.3.10.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

tcpip_types.h

@4

union { ... }

checksum

uint16_t checksum

code

uint8_t code

type

uint8_t type

typeCode

uint16_t typeCode

2.9.3.11 inAddr_t Struct Reference

INET address.

2.9.3.11.1 Detailed Description

INET address.

#include <tcpip_types.h>

2.9.3.11.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

tcpip_types.h

@16

union { ... }

s_addr

uint32_t s_addr

s_addr_byte

uint8_t s_addr_byte[4]

2.9.3.12 ip_db_info_t Struct Reference

Contains IP information.

2.9.3.12.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

ip_database.h

ipv4_dns

uint32_t ipv4_dns[MAX_DNS]

Primary & secondary DNS addresses

ipv4_gateway

uint32_t ipv4_gateway

Gateway address

ipv4_myAddress

uint32_t ipv4_myAddress

IP address

ipv4_ntpAddress

uint32_t ipv4_ntpAddress[MAX_NTP]

NTP addresses

ipv4_router

uint32_t ipv4_router

Router address

ipv4_subnetMask

uint32_t ipv4_subnetMask

Subnet mask

ipv4_tftpAddress

uint32_t ipv4_tftpAddress

TFTP address

2.9.3.13 ipv4_pseudo_header_t Struct Reference

Pseudo header used for checksum calculation on UDP and TCP.

2.9.3.13.1 Detailed Description

Pseudo header used for checksum calculation on UDP and TCP.

#include <tcpip_types.h>

2.9.3.13.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

tcpip_types.h

dstIpAddress

uint32_t dstIpAddress

Destination IP Address

length

uint16_t length

Length

protocol

uint8_t protocol

Protocol

srcIpAddress

uint32_t srcIpAddress

Source IP Address

z

uint8_t z

Used for memory cleaning

2.9.3.14 ipv4Header_t Struct Reference

IPv4 header information.

2.9.3.14.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

tcpip_types.h

__pad0__

unsigned __pad0__

Leave this bit as zero

dontFragment

unsigned dontFragment

Drop if fragmentation is required to route

dscp

unsigned dscp

Differentiated Service Code Point RFC3260

dstIpAddress

uint32_t dstIpAddress

Destination IP Address

ecn

unsigned ecn

Explicit Congestion Notification RFC3168

fragmentOffsetHigh

unsigned fragmentOffsetHigh

Offset for a fragment, needed for reassembly

fragmentOffsetLow

uint8_t fragmentOffsetLow

Low byte for the fragment offset

headerCksm

uint16_t headerCksm

RFC1071 defines this calculation

identifcation

uint16_t identifcation

ID for packet fragments

ihl

unsigned ihl

Internet header length in 32-bit words

length

uint16_t length

Total length including header and data (no more than 576 octets)

moreFragments

unsigned moreFragments

Fragments have this bit set (except for the final packet)

protocol

uint8_t protocol

IP Protocol (from RFC790)

srcIpAddress

uint32_t srcIpAddress

Source IP Address

timeToLive

uint8_t timeToLive

Decrement at each hop and discard when zero

version

unsigned version

4 for IPV4

2.9.3.15 lldp_per_port_t Struct Reference

LLDP per port.

2.9.3.15.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

lldp.c

adminStatus

uint8_t adminStatus

IEEE 802.1AB 9.2.5.1

allocatedPower

uint16_t allocatedPower

desiredPower

uint16_t desiredPower

newNeighbor

bool newNeighbor

portEnabled

bool portEnabled

IEEE 802.1AB 9.2.4.1

rx

lldp_rx_port_t rx

source_ipaddr

uint8_t source_ipaddr[4]

source_mac

uint8_t source_mac[6]

tx

lldp_tx_port_t tx

2.9.3.16 lldp_rx_port_t Struct Reference

Per-interface structure for RX, part of lldp_port.

2.9.3.16.1 Detailed Description

Per-interface structure for RX, part of lldp_port.

2.9.3.16.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

lldp.c

badFrame

bool badFrame

rcvFrame

bool rcvFrame

state

uint8_t state

2.9.3.17 lldp_tx_port_t Struct Reference

Per-interface structure for TX, part of lldp_port.

2.9.3.17.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

lldp.c

localChange

bool localChange

IEEE 802.1AB var

state

uint8_t state

The TX state for this interface

timers

lldp_tx_timers_t timers

LLDP TX state machine timers for this interface

txCredit

uint8_t txCredit

IEEE 802.1AB 9.2.5.16

txFast

uint8_t txFast

IEEE 802.1AB 9.2.5.18

txNow

bool txNow

IEEE 802.1AB 9.2.5.20

txTTL

uint16_t txTTL

IEEE 802.1AB var

2.9.3.18 lldp_tx_timers_t Struct Reference

LLDP TX timers.

2.9.3.18.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

lldp.h

txDelay

uint16_t txDelay

IEEE 802.1AB 10.5.3

txDelayWhile

uint16_t txDelayWhile

txShutdownWhile

uint16_t txShutdownWhile

IEEE 802.1AB 9.2.2.3

txTick

bool txTick

IEEE 802.1AB 9.2.5.21

txTTR

uint16_t txTTR

IEEE 802.1AB 9.2.2.3 Transmit on expire

2.9.3.19 logFields_t Struct Reference

Log fields.

2.9.3.19.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

log.h

logFacility

LOG_FACILITY logFacility

severityThreshold

LOG_SEVERITY severityThreshold

2.9.3.20 orgProcessFlags Union Reference

Process flags.

2.9.3.20.2 Member Data Documentation

The documentation for this union was generated from the following file:

source/

lldp.h

@1

struct { ... }

__pad0__

unsigned __pad0__

fixTlvSize

unsigned fixTlvSize

is4WireSupported

unsigned is4WireSupported

Switch capabilities - RO for all practical purposes

PD_requestSparePairOn

unsigned PD_requestSparePairOn

Only if the desired power is more than 25.5w and 4-wire supported

poeEnabledMinPower

unsigned poeEnabledMinPower

poeEnabledPair

unsigned poeEnabledPair

poePlusEnabledPower

unsigned poePlusEnabledPower

uPoeEnabledPower

unsigned uPoeEnabledPower

val

uint8_t val

2.9.3.21 orgSpecificTLVs_t Struct Reference

Initializes the Organizationally Specific TLV.

2.9.3.21.1 Detailed Description

Initializes the Organizationally Specific TLV.

#include <lldp.h>

2.9.3.21.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

lldp.h

oui

uint32_t oui

processOrgTlvs

OrgFuncPtr processOrgTlvs

subtype

uint8_t subtype

2.9.3.22 sockaddr_in4_t Struct Reference

INET4 socket address.

2.9.3.22.1 Detailed Description

INET4 socket address.

#include <tcpip_types.h>

2.9.3.22.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

tcpip_types.h

addr

inAddr_t addr

port

uint16_t port

2.9.3.23 store_handler_t Struct Reference

Storage handler.

2.9.3.23.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

tftp_handler_table.h

storeNumber

uint16_t storeNumber

TFTP_CallBack

TFTP_receive_function_ptr TFTP_CallBack

2.9.3.24 tcpHeader_t Struct Reference

TCP header information.

2.9.3.24.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

tcpip_types.h

@10

union { ... }

@8

union { ... }

ack

uint8_t ack

Indicates that the ACKfield is significant.

ackNumber

uint32_t ackNumber

ACK Number

byte13

uint8_t byte13

checksum

uint16_t checksum

TCP Header Checksum.

cwr

uint8_t cwr

Congestion Window Reduced (CWR) (added to header by RFC 3168).

dataOffset

uint8_t dataOffset

Specifies the size of the TCP header in 32-bit words.

destPort

uint16_t destPort

Destination port

ece

uint8_t ece

ECN-Echo. Depends on SYN flag set or clear.

fin

uint8_t fin

No more data from sender.

flags

uint8_t flags

Flags

ns

uint8_t ns

ECN-nonce concealment protection (added to header by RFC 3540).

psh

uint8_t psh

Asks to push the buffered data to the receiving application.

reserved

uint8_t reserved

For future use and needs to be set to zero.

rst

uint8_t rst

Resets the connection.

sequenceNumber

uint32_t sequenceNumber

Sequence number

sourcePort

uint16_t sourcePort

Source port

syn

uint8_t syn

Synchronizes sequence numbers. Only the first packet sent from each end must have this flag set.

urg

uint8_t urg

Indicates that the Urgent pointer field is significant.

urgentPtr

uint16_t urgentPtr

Urgent pointer.

windowSize

uint16_t windowSize

Window size.

2.9.3.25 tcpSocket_t Struct Reference

#include <tcpv4.h>

2.9.3.25.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

tcpv4.h

localIP

uint32_t localIP

localPort

uint16_t localPort

remoteIP

uint32_t remoteIP

remotePort

uint16_t remotePort

2.9.3.26 tcpTCB_t Struct Reference

Defines TCP Transmission Control Block.

2.9.3.26.1 Detailed Description

Defines TCP Transmission Control Block.

#include <tcpv4.h>

Public Attributes

2.9.3.26.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

tcpv4.h

bytesSent

uint16_t bytesSent

bytesToSend

uint16_t bytesToSend

connectionEvent

tcpEvent_t connectionEvent

destIP

uint32_t destIP

destPort

uint16_t destPort

flags

uint8_t flags

Save the flags to be used for time-outs

fsmState

tcp_fsm_states_t fsmState

Connection state

localLastAck

uint32_t localLastAck

Last ACK number received

localPort

uint16_t localPort

Local Port

localSeqno

uint32_t localSeqno

localWnd

uint16_t localWnd

Receiver window

mss

uint16_t mss

nextTCB

void* nextTCB

Downstream list pointer

payloadSave

bool payloadSave

prevTCB

void* prevTCB

Upstream list pointer

remoteAck

uint32_t remoteAck

Last ACK packet sent to remote

remoteSeqno

uint32_t remoteSeqno

remoteWnd

uint16_t remoteWnd

Sender window

rxBufferPtr

uint8_t* rxBufferPtr

Pointer to write inside the RX buffer

rxBufferStart

uint8_t* rxBufferStart

rxBufState

tcpBufferState_t rxBufState

socketState

socketState_t socketState

Socket states used in application

timeout

uint16_t timeout

Retransmission time-out in seconds

timeoutReloadValue

uint16_t timeoutReloadValue

timeoutsCount

uint8_t timeoutsCount

Number of retransmissions

txBufferPtr

uint8_t* txBufferPtr

txBufferStart

uint8_t* txBufferStart

txBufState

tcpBufferState_t txBufState

2.9.3.27 tftp_t Struct Reference

#include <tftp.h>

2.9.3.27.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

tftp.h

tftp_block_size

char tftp_block_size[5]

tftp_filename

char tftp_filename[32]

tftp_server_address

uint32_t tftp_server_address

2.9.3.28 udp_handler_t Struct Reference

UDP handler types.

2.9.3.28.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

udpv4_port_handler_table.h

callBack

ip_receive_function_ptr callBack

portNumber

uint16_t portNumber

2.9.3.29 udpHeader_t Struct Reference

UDP header information.

2.9.3.29.1 Detailed Description

UDP header information.

#include <tcpip_types.h>

2.9.3.29.2 Member Data Documentation

The documentation for this struct was generated from the following file:

source/

tcpip_types.h

checksum

uint16_t checksum

Checksum

dstPort

uint16_t dstPort

Destination Port

length

uint16_t length

Length

srcPort

uint16_t srcPort

Source Port

2.9.4 File Documentation

2.9.4.1 source/arpv4.c File Reference

This file provides the API implementation for the Address Resolution Protocol (ARP) v4.

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "../tcpip_types.h"
#include "../network.h"
#include "../arpv4.h"
#include "../../ethernet/physical_layer_interface.h"
#include "../ipv4.h"
#include "../tcpip_config.h"
#include "../ip_database.h"

2.9.4.1.1 Data structures

2.9.4.1.2 Functions

  • void ARPV4_Init (void)

    Initializes the ARP table.

  • error_msg ARPV4_Packet (void)

    Receives all ARP packets on the network and searches the ARP table for an existing ARP entry. If present, it updates the table. If the ARP packet is for the device and its operation is REQUEST, the function replies with the device MAC address.

  • void ARPV4_Update (void)

    Updates the ARP table at least every 10s to avoid aging.

  • error_msg ARPV4_Request (uint32_t destAddress)

    Sends the ARP Request.

  • mac48Address_t * ARPV4_Lookup (uint32_t ip_address)

    Maintains an ARP table which maps hardware address to internet address.

2.9.4.1.5 Detailed Description

This file provides the API implementation for the Address Resolution Protocol (ARP) v4.

ARP v4 Implementation Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.1.6 Macro Definition Documentation

ARP_NAK

#define ARP_NAK 10

ARP_REPLY

#define ARP_REPLY 2

ARP_REQUEST

#define ARP_REQUEST 1

2.9.4.1.7 Variable Documentation

arpMap

arpMap_t arpMap[ARP_MAP_SIZE]

hostMacAddress

mac48Address_t hostMacAddress

2.9.4.2 source/arpv4.h File Reference

#include "../ethernet/physical_layer_interface.h"
#include "tcpip_config.h"

2.9.4.2.1 Functions

  • void ARPV4_Init (void)

    Initializes the ARP table.

  • error_msg ARPV4_Packet (void)

    Receives all ARP packets on the network and searches the ARP table for an existing ARP entry. If present, it updates the table. If the ARP packet is for the device and its operation is REQUEST, the function replies with the device MAC address.

  • void ARPV4_Update (void)

    Updates the ARP table at least every 10s to avoid aging.

  • mac48Address_t * ARPV4_Lookup (uint32_t ipAddress)

    Maintains an ARP table which maps hardware address to internet address.

  • error_msg ARPV4_Request (uint32_t destAddress)

    Sends the ARP Request.

2.9.4.2.2 Detailed Description

ARPv4 Protocol Header file

2.9.4.3 source/dhcp_client.c File Reference

This file provides the API implementation for the DHCP client.

#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdbool.h>
#include <limits.h>
#include "../log.h"
#include "../../ethernet/physical_layer_interface.h"
#include "../network.h"
#include "../udpv4.h"
#include "../udpv4_port_handler_table.h"
#include "../ipv4.h"
#include "../arpv4.h"
#include "../dhcp_client.h"
#include "../ip_database.h"
#include "../lfsr.h"

2.9.4.3.2 Functions

2.9.4.3.4 Enumerations

2.9.4.3.6 Detailed Description

This file provides the API implementation for the DHCP client.

DHCP v4 client Implementation Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.3.7 Macro Definition Documentation

DHCP_HEADER_SIZE

#define DHCP_HEADER_SIZE 240

DHCP_REQUEST_LENGTH

#define DHCP_REQUEST_LENGTH DHCP_PACKET_SIZE

logMsg

#define logMsg( msg, msgSeverity, msgLogDest)

2.9.4.3.8 Variable Documentation

dhcpData

dhcp_data_t dhcpData = {0,0,0,{0,0},{0,0},0,0,10,3600,0}

dhcpName

const char dhcpName[] = "PIC16F18857 Ethernet"

dhcpState

dhcp_state_t dhcpState = {SELECTING,INIT_TIMER}

ethMAC

mac48Address_t ethMAC[static]

2.9.4.4 source/dhcp_client.h File Reference

#include "tcpip_types.h"
#include "tcpip_config.h"

2.9.4.4.1 Functions

  • void DHCP_init (void)

    Initializes the DHCP.

  • void DHCP_Handler (int16_t length)

    Receives and processes the DHCP packet.

  • void DHCP_Manage (void)

    Updates the DHCP status at least every one second.

  • void DHCP_WriteZeros (uint16_t length)

    Writes zeroes for the number of bytes passed.

2.9.4.4.2 Detailed Description

DHCPv4 Client Protocol Header File

2.9.4.5 source/dns_client.c File Reference

This file provides the API implementation for the DNS client stack.

#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include "../dns_client.h"
#include "../udpv4.h"
#include "../log.h"
#include "../ip_database.h"
#include "../lfsr.h"

2.9.4.5.2 Functions

  • static int generateSeed (void)

    Generates the seed.

  • void DNS_Init (void)

    Initializes the DNS table.

  • void DNS_Query (const char *str)

    Searches the DNS server for the IPv4 (type A) addresses of the domain names.

  • void DNS_Handler (int16_t length)

    Receives and processes the DNS packet.

  • void DNS_Update (void)

    Updates the DNS table at least every 10s to avoid aging.

  • uint32_t DNS_Lookup (const char *dns_name)

    Maintains the DNS table and maps Domain names to the Internet address.

2.9.4.5.5 Detailed Description

This file provides the API implementation for the DNS client stack.

DNS client Implementation Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.5.6 Macro Definition Documentation

ARRAYSIZE

#define ARRAYSIZE( a) (sizeof(a) / sizeof(*(a)))

DNS_CLASS_SIZE

#define DNS_CLASS_SIZE 2

DNS_HEADER_SIZE

#define DNS_HEADER_SIZE 12

DNS_MAP_SIZE

#define DNS_MAP_SIZE 8

DNS_PACKET_SIZE

#define DNS_PACKET_SIZE (DNS_HEADER_SIZE + DNS_QUERY_SIZE)

DNS_QUERY_SIZE

#define DNS_QUERY_SIZE (DNS_TYPE_SIZE + DNS_CLASS_SIZE)

DNS_TYPE_SIZE

#define DNS_TYPE_SIZE 2

logMsg

#define logMsg( msg, msgSeverity, msgLogDest)

2.9.4.5.7 Variable Documentation

dnsCache

dns_map_t dnsCache[DNS_MAP_SIZE]

dnsXidValue

uint16_t dnsXidValue

ethMACdns

mac48Address_t ethMACdns

2.9.4.6 source/dns_client.h File Reference

#include <stdint.h>

2.9.4.6.1 Functions

  • void DNS_Init (void)

    Initializes the DNS table.

  • void DNS_Query (const char *str)

    Searches the DNS server for the IPv4 (type A) addresses of the domain names.

  • void DNS_Handler (int16_t length)

    Receives and processes the DNS packet.

  • uint32_t DNS_Lookup (const char *dns_name)

    Maintains the DNS table and maps Domain names to the Internet address.

  • void DNS_Update (void)

    Updates the DNS table at least every 10s to avoid aging.

2.9.4.6.2 Detailed Description

DNSv4 Client Protocol Header File

2.9.4.7 source/icmp.c File Reference

This file provides the API implementation for the Internet Control Message Protocol (ICMP).

#include <stdint.h>
#include <stdio.h>
#include <stddef.h>
#include "../network.h"
#include "../tcpip_types.h"
#include "../../ethernet/physical_layer_interface.h"
#include "../ipv4.h"
#include "../icmp.h"
#include "../ip_database.h"

2.9.4.7.1 Functions

2.9.4.7.3 Detailed Description

This file provides the API implementation for the Internet Control Message Protocol (ICMP).

ICMP protocol Implementation Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.7.4 Variable Documentation

portUnreachable

uint16_t portUnreachable = 0

2.9.4.8 source/icmp.h File Reference

2.9.4.8.1 Functions

2.9.4.8.3 Detailed Description

ICMPv4 Protocol Header File

2.9.4.8.4 Macro Definition Documentation

DEST_UNREACHABLE_LEN

#define DEST_UNREACHABLE_LEN 64

2.9.4.9 source/ip_database.c File Reference

This file provides the API implementation for the IP database.

#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "../ip_database.h"

2.9.4.9.3 Detailed Description

This file provides the API implementation for the IP database.

IP Database Implementation Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.9.4 Variable Documentation

ip_database_info

ip_db_info_t ip_database_info

2.9.4.10 source/ip_database.h File Reference

This file contains IP addresses for different operations.

2.9.4.10.1 Data structures

2.9.4.10.3 Macros

2.9.4.10.5 Detailed Description

This file contains IP addresses for different operations.

IP Database Header File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.10.6 Macro Definition Documentation

ALL_HOST_MULTICAST_ADDRESS

#define ALL_HOST_MULTICAST_ADDRESS 0xE0000001

CLASS_A_IPV4_BROADCAST_MASK

#define CLASS_A_IPV4_BROADCAST_MASK 0XFF000000

CLASS_A_IPV4_REVERSE_BROADCAST_MASK

#define CLASS_A_IPV4_REVERSE_BROADCAST_MASK 0x00FFFFFF

CLASS_B_IPV4_BROADCAST_MASK

#define CLASS_B_IPV4_BROADCAST_MASK 0xFFFF0000

CLASS_B_IPV4_REVERSE_BROADCAST_MASK

#define CLASS_B_IPV4_REVERSE_BROADCAST_MASK 0x0000FFFF

CLASS_C_IPV4_BROADCAST_MASK

#define CLASS_C_IPV4_BROADCAST_MASK 0xFFFFFF00

CLASS_C_IPV4_REVERSE_BROADCAST_MASK

#define CLASS_C_IPV4_REVERSE_BROADCAST_MASK 0X000000FF

ipdb_classAbroadcastAddress

#define ipdb_classAbroadcastAddress( ) (ip_database_info.ipv4_myAddress|CLASS_A_IPV4_REVERSE_BROADCAST_MASK)

ipdb_classBbroadcastAddress

#define ipdb_classBbroadcastAddress( ) (ip_database_info.ipv4_myAddress|CLASS_B_IPV4_REVERSE_BROADCAST_MASK)

ipdb_classCbroadcastAddress

#define ipdb_classCbroadcastAddress( ) (ip_database_info.ipv4_myAddress|CLASS_C_IPV4_REVERSE_BROADCAST_MASK)

ipdb_getAddress

#define ipdb_getAddress( ) (ip_database_info.ipv4_myAddress)

ipdb_getDNS

#define ipdb_getDNS( x) (x < MAX_DNS ? ip_database_info.ipv4_dns[x] : ip_database_info.ipv4_dns[0])

ipdb_getNTP

#define ipdb_getNTP( x) (x < MAX_NTP ? ip_database_info.ipv4_ntpAddress[x] : ip_database_info.ipv4_ntpAddress[0])

ipdb_getRouter

#define ipdb_getRouter( ) (ip_database_info.ipv4_router)

ipdb_getSubNetMASK

#define ipdb_getSubNetMASK( ) (ip_database_info.ipv4_subnetMask)

ipdb_getTFTP

#define ipdb_getTFTP( ) (ip_database_info.ipv4_tftpAddress)

ipdb_setAddress

#define ipdb_setAddress( a) do{ ip_database_info.ipv4_myAddress = a; } while(0)

ipdb_setDNS

#define ipdb_setDNS( x, v) do{ if(x < MAX_DNS) ip_database_info.ipv4_dns[x] = v; } while(0)

ipdb_setGateway

#define ipdb_setGateway( g) do{ ip_database_info.ipv4_gateway = g; } while(0)

ipdb_setNTP

#define ipdb_setNTP( x, n) do{ if(x < MAX_NTP) ip_database_info.ipv4_ntpAddress[x] = n; } while(0)

ipdb_setRouter

#define ipdb_setRouter( r) do{ ip_database_info.ipv4_router = r; } while(0)

ipdb_setSubNetMASK

#define ipdb_setSubNetMASK( m) do{ ip_database_info.ipv4_subnetMask = m; } while(0)

ipdb_setTFTP

#define ipdb_setTFTP( a) do{ ip_database_info.ipv4_tftpAddress = a; } while(0)

ipdb_specialbroadcastAddress

#define ipdb_specialbroadcastAddress( ) SPECIAL_IPV4_BROADCAST_ADDRESS

IPV4_ZERO_ADDRESS

#define IPV4_ZERO_ADDRESS 0

LOCAL_HOST_ADDRESS

#define LOCAL_HOST_ADDRESS 0x7F000001

MAX_DNS

#define MAX_DNS 2

MAX_NTP

#define MAX_NTP 2

SPECIAL_IPV4_BROADCAST_ADDRESS

#define SPECIAL_IPV4_BROADCAST_ADDRESS 0xFFFFFFFF

2.9.4.10.7 Variable Documentation

ip_database_info

ip_db_info_t ip_database_info

2.9.4.11 source/ipv4.c File Reference

This file provides the API implementation for IPv4.

#include <stdint.h>
#include <stdio.h>
#include <stddef.h>
#include "../network.h"
#include "../ipv4.h"
#include "../icmp.h"
#include "../arpv4.h"
#include "../udpv4.h"
#include "../udpv4_port_handler_table.h"
#include "../tcpv4.h"
#include "../tcpip_types.h"
#include "../../ethernet/physical_layer_interface.h"
#include "../log.h"
#include "../ip_database.h"

2.9.4.11.1 Functions

  • void TCP_Recv (uint32_t remoteAddress, uint16_t length)

    Receives TCP packets.

  • static uint8_t getHeaderLen (void)

    Returns the header length.

  • void IPV4_Init (void)

    Initializes IPv4.

  • uint16_t IPV4_PseudoHeaderChecksum (uint16_t payloadLen)

    Computes the pseudo-header checksum for transport layer protocols.

  • error_msg IPV4_Packet (void)

    Receives the IPv4 packet. This function reads the IPv4 header and filters the upper layer protocols.

  • error_msg IPv4_Start (uint32_t dstAddress, ipProtocolNumbers protocol)

    Starts the IPv4 packet. This routine starts the Ethernet packet and writes the IPv4 header. Initially Checksum and Payload length are set to '0'. An error code is returned if there has been an error in accepting, or if something goes wrong.

  • error_msg IPV4_Send (uint16_t payloadLength)

    Sends the IPv4 packet. This function inserts the total length of IPv4 packet, computes and adds the Ipv4 header checksum.

  • uint16_t IPV4_GetDatagramLength (void)

    Returns the length of the IPv4 datagram.

2.9.4.11.2 Macros

  • #define logMsg(msg, msgSeverity, msgLogDest)

2.9.4.11.4 Detailed Description

This file provides the API implementation for IPv4.

IPv4 Implementation Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.11.5 Function Documentation

IPV4_Init()

void IPV4_Init (void )

Initializes IPv4.

Parameters:
None.
Returns:

None.

2.9.4.11.6 Macro Definition Documentation

logMsg

#define logMsg( msg, msgSeverity, msgLogDest)

2.9.4.11.7 Variable Documentation

ipv4Header

ipv4Header_t ipv4Header

remoteIpv4Address

uint32_t remoteIpv4Address

2.9.4.12 source/ipv4.h File Reference

#include <stdbool.h>
#include "tcpip_types.h"
#include "../ethernet/physical_layer_interface.h"

2.9.4.12.1 Functions

  • void IPV4_Init (void)

    Initializes IPv4.

  • error_msg IPV4_Packet (void)

    Receives the IPv4 packet. This function reads the IPv4 header and filters the upper layer protocols.

  • error_msg IPv4_Start (uint32_t dstAddress, ipProtocolNumbers protocol)

    Starts the IPv4 packet. This routine starts the Ethernet packet and writes the IPv4 header. Initially Checksum and Payload length are set to '0'. An error code is returned if there has been an error in accepting, or if something goes wrong.

  • uint16_t IPV4_PseudoHeaderChecksum (uint16_t payloadLen)

    Computes the pseudo-header checksum for transport layer protocols.

  • error_msg IPV4_Send (uint16_t payloadLength)

    Sends the IPv4 packet. This function inserts the total length of IPv4 packet, computes and adds the Ipv4 header checksum.

  • uint16_t IPV4_GetDatagramLength (void)

    Returns the length of the IPv4 datagram.

2.9.4.12.2 Detailed Description

IPv4 Protocol Header File

2.9.4.12.3 Function Documentation

IPV4_Init()

void IPV4_Init (void )

Initializes IPv4.

Parameters:
None.
Returns:

None.

2.9.4.13 source/lfsr.c File Reference

This file provides the API prototypes for the Linear Feedback Shift Register (LFSR) module.

#include "../lfsr.h"

2.9.4.13.4 Detailed Description

This file provides the API prototypes for the Linear Feedback Shift Register (LFSR) module.

LFSR Implementation Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.13.5 Function Documentation

lfsr()

lfsr_t lfsr (void )

Returns the LFSR value.

Parameters:
None.
Returns:

Value of LFSR.

lfsr_getSequence()

lfsr_t lfsr_getSequence (void )

Returns the LFSR sequence.

Parameters:
None.
Returns:

Sequence.

lfsr_getSequenceCount()

int lfsr_getSequenceCount (void )

Returns the LFSR sequence count.

Parameters:
None.
Returns:

Sequence count.

lfsr_reset()

void lfsr_reset (void )

Resets the LFSR.

Parameters:
None.
Returns:

None.

lfsr_setSequence()

void lfsr_setSequence (uint16_t s)

Sets the LFSR sequence.

Parameters:
s

Sequence

Returns:

None.

lfsrWithSeed()

lfsr_t lfsrWithSeed (uint8_t lfsrSeed)

Returns the LFSR value with seed.

Parameters:
lfsrSeed

LFSR with seed

Returns:

Value of LFSR with seed.

2.9.4.13.6 Macro Definition Documentation

lfsr_seed

#define lfsr_seed 0x40

lfsrOutputMask

#define lfsrOutputMask 0x7fu

2.9.4.13.7 Variable Documentation

lfsr_value

lfsr_t lfsr_value = lfsr_seed

sequenceIndex

uint8_t sequenceIndex = 0[static]

xor_mask

lfsr_t xor_mask = 0x41

xorSequences

const lfsr_t xorSequences[] = {0x41,0x44,0x47,0x48,0x4E,0x53,0x55,0x5C,0x5F,0x60,0x65,0x69,0x6A,0x72,0x77,0x78,0x7B,0x7E}

2.9.4.14 source/lfsr.h File Reference

This file provides the API implementation for the Linear Feedback Shift Register (LFSR).

#include <stdint.h>

2.9.4.14.2 Typedefs

2.9.4.14.3 Detailed Description

This file provides the API implementation for the Linear Feedback Shift Register (LFSR).

lfsr API Header File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.14.4 Function Documentation

lfsr()

lfsr_t lfsr (void )

Returns the LFSR value.

Parameters:
None.
Returns:

Value of LFSR.

lfsr_getSequence()

lfsr_t lfsr_getSequence (void )

Returns the LFSR sequence.

Parameters:
None.
Returns:

Sequence.

lfsr_getSequenceCount()

int lfsr_getSequenceCount (void )

Returns the LFSR sequence count.

Parameters:
None.
Returns:

Sequence count.

lfsr_reset()

void lfsr_reset (void )

Resets the LFSR.

Parameters:
None.
Returns:

None.

lfsr_setSequence()

void lfsr_setSequence (uint16_t s)

Sets the LFSR sequence.

Parameters:
s

Sequence

Returns:

None.

lfsrWithSeed()

lfsr_t lfsrWithSeed (uint8_t lfsrSeed)

Returns the LFSR value with seed.

Parameters:
lfsrSeed

LFSR with seed

Returns:

Value of LFSR with seed.

2.9.4.14.5 Typedef Documentation

lfsr_t

typedef uint8_t lfsr_t

2.9.4.15 source/lldp.c File Reference

This file provides the API implementation of LLDP.

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "../network.h"
#include "../../ethernet/physical_layer_interface.h"
#include "../log.h"
#include "../lldp_tlv_handler_table.h"
#include "../ipv4.h"
#include "../ip_database.h"

2.9.4.15.2 Functions

2.9.4.15.3 Macros

2.9.4.15.4 Enumerations

2.9.4.15.5 Variables

2.9.4.15.6 Detailed Description

This file provides the API implementation of LLDP.

LLDP Implementation Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.15.7 Function Documentation

buffFitCheck()

bool buffFitCheck (uint16_t )

chkBoundaryCase()

void chkBoundaryCase (void )

constrInfoLLDPDU()

void constrInfoLLDPDU (void )

createBasicTLV()

error_msg createBasicTLV (uint8_t type, uint8_t sub, uint16_t buffLen)

createChassisTLV()

error_msg createChassisTLV (uint8_t type, uint8_t sub, uint16_t buffLen)

createEndTLV()

bool createEndTLV (void )

createMgmtAddrTLV()

error_msg createMgmtAddrTLV (uint8_t type, uint8_t sub, uint16_t buffLen)

createOptionalTLV()

error_msg createOptionalTLV (uint8_t , uint8_t , uint16_t )

createOrgTLV()

error_msg createOrgTLV (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

createPortDesc()

error_msg createPortDesc (uint8_t type, uint8_t sub, uint16_t buffLen)

createPortTLV()

error_msg createPortTLV (uint8_t type, uint8_t sub, uint16_t buffLen)

createSysCap()

error_msg createSysCap (uint8_t type, uint8_t sub, uint16_t buffLen)

createSystemDesc()

error_msg createSystemDesc (uint8_t type, uint8_t sub, uint16_t buffLen)

createTTLTLV()

error_msg createTTLTLV (uint8_t type, uint8_t sub, uint16_t buffLen)

LLDP_createCisco_MUD_Ext()

error_msg LLDP_createCisco_MUD_Ext (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createCiscoClass()

error_msg LLDP_createCiscoClass (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createCiscoMDI()

error_msg LLDP_createCiscoMDI (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createCiscoOUI()

error_msg LLDP_createCiscoOUI (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createCiscoProtocol()

error_msg LLDP_createCiscoProtocol (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createIeeeConfig()

error_msg LLDP_createIeeeConfig (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createIeeeMDI()

error_msg LLDP_createIeeeMDI (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_Asset_ID()

error_msg LLDP_createTia_Asset_ID (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_FW_Rev()

error_msg LLDP_createTia_FW_Rev (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_HW_Rev()

error_msg LLDP_createTia_HW_Rev (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_Manufacturer_Name()

error_msg LLDP_createTia_Manufacturer_Name (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_Model_Name()

error_msg LLDP_createTia_Model_Name (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_Net_pol()

error_msg LLDP_createTia_Net_pol (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_PWR_MDI()

error_msg LLDP_createTia_PWR_MDI (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_Srl_Num()

error_msg LLDP_createTia_Srl_Num (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_SW_Rev()

error_msg LLDP_createTia_SW_Rev (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTiaMED_cap()

error_msg LLDP_createTiaMED_cap (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

processCiscoPowerTlv()

error_msg processCiscoPowerTlv (uint8_t len, uint32_t oui, uint8_t orgSubtype)

processEnd()

bool processEnd (uint16_t tlvLength)

processError()

void processError (void )

processIEEE3PowerTlv()

error_msg processIEEE3PowerTlv (uint8_t len, uint32_t oui, uint8_t orgSubtype)

processMandatory()

void processMandatory (uint8_t tlvType, uint16_t tlvLength)

processOptional()

void processOptional (uint8_t tlvType, uint16_t tlvLength)

processSpecific()

void processSpecific (uint16_t tlvLength)

rxProcessFrame()

void rxProcessFrame (void )

rxStateMachine()

void rxStateMachine (void )

setTheTLV()

static error_msg setTheTLV (uint8_t sub, uint16_t buffLen, uint32_t orgOUI, char * val)[static]

swapEvenBytes()

static void swapEvenBytes (void * ptr, uint8_t len)[static]

tl_tlvConstruct()

uint8_t tl_tlvConstruct (uint8_t type, uint16_t length, uint8_t whichField)

txFrame()

void txFrame (void )

txStateMachine()

void txStateMachine (void )

txTimerInitializeLLDP()

void txTimerInitializeLLDP (void )

txTimerStateMachine()

void txTimerStateMachine (void )

2.9.4.15.8 Macro Definition Documentation

ADMIN_STATUS_RX_MASK

#define ADMIN_STATUS_RX_MASK 0x02

ADMIN_STATUS_TX_MASK

#define ADMIN_STATUS_TX_MASK 0x01

ARRAYSIZE

#define ARRAYSIZE( a) (sizeof(a)/sizeof(*(a)))

disableLLDP

#define disableLLDP( ) do{lldp_port.adminStatus=(lldp_admin_status)disabled;}while(0)

enableLLDP_rx

#define enableLLDP_rx( ) do{lldp_port.adminStatus=(lldp_admin_status)enabledRxOnly;}while(0)

enableLLDP_rx_tx

#define enableLLDP_rx_tx( ) do{lldp_port.adminStatus=(lldp_admin_status)enabledRxTx;}while(0)

enableLLDP_tx

#define enableLLDP_tx( ) do{lldp_port.adminStatus=(lldp_admin_status)enabledTxOnly;}while(0)

lengthField

#define lengthField 2

LLDP_isDisabled

#define LLDP_isDisabled( ) (lldp_port.adminStatus == 0)

LLDP_rxEnabled

#define LLDP_rxEnabled( ) ((lldp_port.adminStatus & ADMIN_STATUS_RX_MASK) != 0)

LLDP_txEnabled

#define LLDP_txEnabled( ) ((lldp_port.adminStatus & ADMIN_STATUS_TX_MASK) != 0)

logMsg

#define logMsg( msg, msgSeverity, msgLogDest)

typeField

#define typeField 1

2.9.4.15.9 Variable Documentation

AddressType

const uint8_t AddressType = 1

assetID

char* assetID =NULL

AssetID

const char AssetID[] ="V1234"

firmwarerev

char* firmwarerev =NULL

FirmwareRevision

const char FirmwareRevision[] ="Rev 1.0"

genericMAC

const mac48Address_t genericMAC ={{0X01,0X80,0XC2,0X00,0X00,0X0E}}[static]

hardwarerev

char* hardwarerev =NULL

HardwareRevision

const char HardwareRevision[] ="Rev 1.0"

lldp_port

lldp_per_port_t lldp_port

lldp_tx_timers

lldp_tx_timers_t lldp_tx_timers = {0,0,0,0,0}

lldpdu_end

bool lldpdu_end

manufacturer

char* manufacturer =NULL

Manufacturer

const char Manufacturer[] ="Vendor ID"

modelname

char* modelname =NULL

ModelName

const char ModelName[] ="LED-Dimmable"

mudext

char* mudext =NULL

MUDExt

const char MUDExt[] ="Add the mud info"

orgProcFlags

orgProcessFlags orgProcFlags[static]

portdescription

char* portdescription =NULL

PortDescription

const char PortDescription[] ="Vendor LED"

PortInterfaceName

char PortInterfaceName[7] ="Gi?/?"

rxState

uint8_t rxState

serialnumber

char* serialnumber =NULL

SerialNumber

const char SerialNumber[] ="US-1234"

softwarerev

char* softwarerev =NULL

SoftwareRevision

const char SoftwareRevision[] ="Rev 1.0"

throughTimes

uint8_t throughTimes

totalSize

uint16_t totalSize

txSizeCount

uint16_t txSizeCount

txTimerState

uint8_t txTimerState

2.9.4.16 source/lldp.h File Reference

#include "tcpip_types.h"
#include "../ethernet/physical_layer_interface.h"

2.9.4.16.2 Functions

2.9.4.16.5 Enumerations

2.9.4.16.7 Detailed Description

LLDP Protocol Header File

2.9.4.16.8 Macro Definition Documentation

clrLLDPTick

#define clrLLDPTick( ) do{lldp_tx_timers.txTick=false;}while(0)

error

#define error

MAX_TXBUFF_SIZE

#define MAX_TXBUFF_SIZE 1500

msgFastTx

#define msgFastTx 1u

IEEE 802.1AB 9.2.5.5, defualt 1 if fast transmit is required

msgTxHold

#define msgTxHold 4

IEEE 802.1AB 10.5.1, default 4

msgTxInterval

#define msgTxInterval 30u

IEEE 802.1AB 10.5.1, default 30s

MulticastMacAddr

#define MulticastMacAddr mac48Address_t

PORTID

#define PORTID mac48Address_t

reinitDelay

#define reinitDelay 2

IEEE 802.1AB 9.2.5.10*, default 2s

setLLDPTick

#define setLLDPTick( ) do{lldp_tx_timers.txTick=true;}while(0)

txCreditMax

#define txCreditMax 5

IEEE 802.1AB 9.2.5.17, default 5

txFastInit

#define txFastInit 4

IEEE 802.1AB 9.2.5.19, default 4

2.9.4.16.9 Typedef Documentation

createBasicFuncPtr

typedef error_msg(* createBasicFuncPtr) (uint8_t, uint8_t, uint16_t)

createOrgFuncPtr

typedef error_msg(* createOrgFuncPtr) (uint8_t, uint16_t, uint32_t)

OrgFuncPtr

typedef error_msg(* OrgFuncPtr) (uint8_t, uint32_t, uint8_t)

2.9.4.16.10 Variable Documentation

lldp_tx_timers

lldp_tx_timers_t lldp_tx_timers

2.9.4.17 source/lldp_tlv_handler_table.c File Reference

This file provides the API implementation for the LLDP TLV handler table.

#include "../lldp_tlv_handler_table.h"

2.9.4.17.1 Functions

2.9.4.17.3 Detailed Description

This file provides the API implementation for the LLDP TLV handler table.

LLDP protocol v4 Implementation Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.17.4 Function Documentation

createChassisTLV()

error_msg createChassisTLV (uint8_t type, uint8_t sub, uint16_t buffLen)

createMgmtAddrTLV()

error_msg createMgmtAddrTLV (uint8_t type, uint8_t sub, uint16_t buffLen)

createPortDesc()

error_msg createPortDesc (uint8_t type, uint8_t sub, uint16_t buffLen)

createPortTLV()

error_msg createPortTLV (uint8_t type, uint8_t sub, uint16_t buffLen)

createSysCap()

error_msg createSysCap (uint8_t type, uint8_t sub, uint16_t buffLen)

createSystemDesc()

error_msg createSystemDesc (uint8_t type, uint8_t sub, uint16_t buffLen)

createTTLTLV()

error_msg createTTLTLV (uint8_t type, uint8_t sub, uint16_t buffLen)

LLDP_createCisco_MUD_Ext()

error_msg LLDP_createCisco_MUD_Ext (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createCiscoClass()

error_msg LLDP_createCiscoClass (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createCiscoMDI()

error_msg LLDP_createCiscoMDI (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createCiscoOUI()

error_msg LLDP_createCiscoOUI (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createCiscoProtocol()

error_msg LLDP_createCiscoProtocol (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createIeeeConfig()

error_msg LLDP_createIeeeConfig (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createIeeeMDI()

error_msg LLDP_createIeeeMDI (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_Asset_ID()

error_msg LLDP_createTia_Asset_ID (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_FW_Rev()

error_msg LLDP_createTia_FW_Rev (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_HW_Rev()

error_msg LLDP_createTia_HW_Rev (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_Manufacturer_Name()

error_msg LLDP_createTia_Manufacturer_Name (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_Model_Name()

error_msg LLDP_createTia_Model_Name (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_Net_pol()

error_msg LLDP_createTia_Net_pol (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_PWR_MDI()

error_msg LLDP_createTia_PWR_MDI (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_Srl_Num()

error_msg LLDP_createTia_Srl_Num (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTia_SW_Rev()

error_msg LLDP_createTia_SW_Rev (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

LLDP_createTiaMED()

error_msg LLDP_createTiaMED (uint8_t , uint16_t , uint32_t )

LLDP_createTiaMED_cap()

error_msg LLDP_createTiaMED_cap (uint8_t sub, uint16_t buffLen, uint32_t orgOUI)

processCiscoPowerTlv()

error_msg processCiscoPowerTlv (uint8_t len, uint32_t oui, uint8_t orgSubtype)

processIEEE3PowerTlv()

error_msg processIEEE3PowerTlv (uint8_t len, uint32_t oui, uint8_t orgSubtype)

2.9.4.17.5 Variable Documentation

independentSparedArchitecture

bool independentSparedArchitecture = true

lldpCallOrgSpecTlvTable

2.9.4.18 source/lldp_tlv_handler_table.h File Reference

This file provides the API implementation for the LLDP TLV handler table.

#include <stdint.h>
#include <stdbool.h>
#include "lldp.h"

2.9.4.18.1 Functions

2.9.4.18.4 Detailed Description

This file provides the API implementation for the LLDP TLV handler table.

LLDP TLV Handler Table Header File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.18.5 Macro Definition Documentation

BASIC_TLVS_TABLE_SIZE

#define BASIC_TLVS_TABLE_SIZE 7

CISCO_ALT_OUI

#define CISCO_ALT_OUI 0x00005E

CISCO_OUI

#define CISCO_OUI 0x000142

IEEE802_3_OUI

#define IEEE802_3_OUI 0x00120F

PROCESSING_TLVS_TABLE_SIZE

#define PROCESSING_TLVS_TABLE_SIZE 2

TIA_OUI

#define TIA_OUI 0x0012BB

2.9.4.18.6 Variable Documentation

independentSparedArchitecture

bool independentSparedArchitecture

lldpCallFixedTlvTable

const createBasicTLV_t lldpCallFixedTlvTable[BASIC_TLVS_TABLE_SIZE]

lldpCallOrgSpecTlvTable

const createOrgTLV_t lldpCallOrgSpecTlvTable[]

lldporgProcessingTlvTable

const orgSpecificTLVs_t lldporgProcessingTlvTable[PROCESSING_TLVS_TABLE_SIZE]

2.9.4.19 source/log.c File Reference

This file provides the API implementation for message logging.

#include <time.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include "../rtcc.h"
#include "../log.h"
#include "../log_console.h"
#include "../log_syslog.h"

2.9.4.19.1 Functions

  • void LOG_Init (void)

    Initializes the service to send log messages. Testing for externals property is done in Subversion (SVN).

  • void logMessage (const char *message, LOG_FACILITY facility, LOG_SEVERITY severity, uint8_t logDest)

    Creates a log message with specified fields.

2.9.4.19.2 Macros

2.9.4.19.4 Detailed Description

This file provides the API implementation for message logging.

Message Logging Implementation Source File  

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.19.5 Function Documentation

LOG_Init()

void LOG_Init (void )

Initializes the service to send log messages. Testing for externals property is done in Subversion (SVN).

Parameters:
None.
Returns:

None.

logMessage()

void logMessage (const char * message, LOG_FACILITY facility, LOG_SEVERITY severity, uint8_t logDest)

Creates a log message with specified fields.

Parameters:
*message
facility

Message facility

severity

Message severity

logDest

Message logging destination

Returns:

None.

2.9.4.19.6 Macro Definition Documentation

LOG_FAC

#define LOG_FAC( p) (((p) & LOG_FACMASK) >> 3)

Facility of priority.

LOG_FACMASK

#define LOG_FACMASK 0x03f8

Mask to extract facility part.

LOG_MAKEPRI

#define LOG_MAKEPRI( fac, pri) (((fac) << 3) | (pri))

LOG_MASK

#define LOG_MASK( pri) (1 << (pri))

Mask for one priority.

LOG_NFACILITIES

#define LOG_NFACILITIES 24

Current number of facilities.

LOG_NILVALUE

#define LOG_NILVALUE "-"

LOG_PRI

#define LOG_PRI( p) ((p) & LOG_PRIMASK)

Extract priority.

LOG_PRIMASK

#define LOG_PRIMASK 0x07

Mask to extract priority part (internal)

LOG_UPTO

#define LOG_UPTO( pri) ((1 << ((pri)+1)) - 1)

All priorities through PRI.

2.9.4.19.7 Variable Documentation

limit

LOG_SEVERITY limit[LOG_LAST]

severityThresholdTable

severityThresholdTable[]

Initial value:

= {
    {  LOG_KERN,   LOG_INFO },
    {  LOG_DTLS,   LOG_NOTICE },
    {  LOG_ECC,   LOG_NOTICE },
    {  LOG_DAEMON, LOG_INFO },
    {  LOG_AUTH,   LOG_NOTICE },
    {  LOG_SYSLOG, LOG_NOTICE },
    {  LOG_LPR,    LOG_INFO },
    {  LOG_NEWS,   LOG_NOTICE },
    {  LOG_TFTP,   LOG_INFO },
    {  LOG_UUID,   LOG_NOTICE },
    {  LOG_COAP,   LOG_NOTICE },
    {  LOG_FTP,    LOG_NOTICE },
    {  LOG_NTP,    LOG_INFO },
    {  LOG_HTTP,   LOG_NOTICE },
    {  LOG_SNMP,   LOG_NOTICE },
    {  LOG_RTCC,   LOG_NOTICE },
    {  LOG_CBOR,   LOG_INFO },
    {  LOG_UDP,    LOG_NOTICE },
    {  LOG_TCP,    LOG_NOTICE },
    {  LOG_DHCP,   LOG_INFO },
    {  LOG_DNS,    LOG_NOTICE },
    {  LOG_LLDP,   LOG_INFO },
    {  LOG_LINK,   LOG_NOTICE },
    
    {  LOG_LAST,   LOG_NOTICE }
}

Sets the severity threshold for each facility.

2.9.4.20 source/log.h File Reference

This file provides the API implementation for sending log messages.

#include <stdint.h>
#include <stdbool.h>

2.9.4.20.1 Data structures

2.9.4.20.2 Functions

  • void LOG_Init (void)

    Initializes the service to send log messages. Testing for externals property is done in Subversion (SVN).

  • void logMessage (const char *message, LOG_FACILITY facility, LOG_SEVERITY severity, uint8_t logDest)

    Creates a log message with specified fields.

2.9.4.20.4 Enumerations

2.9.4.20.6 Detailed Description

This file provides the API implementation for sending log messages.

Log API Header File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.20.7 Function Documentation

LOG_Init()

void LOG_Init (void )

Initializes the service to send log messages. Testing for externals property is done in Subversion (SVN).

Parameters:
None.
Returns:

None.

logMessage()

void logMessage (const char * message, LOG_FACILITY facility, LOG_SEVERITY severity, uint8_t logDest)

Creates a log message with specified fields.

Parameters:
*message
facility

Message facility

severity

Message severity

logDest

Message logging destination

Returns:

None.

2.9.4.20.8 Macro Definition Documentation

LOG_CONSOLE_MASK

#define LOG_CONSOLE_MASK( m) (m & LOG_DEST_CONSOLE)

LOG_DEST_CONSOLE

#define LOG_DEST_CONSOLE 0b00000010

LOG_DEST_EEPROM

#define LOG_DEST_EEPROM 0b00000100

LOG_DEST_ETHERNET

#define LOG_DEST_ETHERNET 0b00000001

LOG_EEPROM_MASK

#define LOG_EEPROM_MASK( m) (m & LOG_DEST_EEPROM)

LOG_ETHERNET_MASK

#define LOG_ETHERNET_MASK( m) (m & LOG_DEST_ETHERNET)

LOG_NILVALUE

#define LOG_NILVALUE "-"

SYSLOG_VERSION

#define SYSLOG_VERSION 1

2.9.4.20.9 Enumeration Type Documentation

LOG_FACILITY

enum LOG_FACILITY

PRI facility codes These facility codes represent the Connected Lighting Stack. Facility codes MUST be in the range of 0 to 23 inclusive.

LOG_KERN

Kernel messages

LOG_DTLS

DTLS messages

LOG_ECC

ECC system

LOG_DAEMON

System daemons

LOG_AUTH

Security/authorization messages

LOG_SYSLOG

Messages generated internally by syslogd

LOG_LPR

Line printer subsystem

LOG_NEWS

Network news subsystem

LOG_TFTP

TFTP service

LOG_UUID

UUID service

LOG_COAP

CoAP service

LOG_FTP

FTP daemon

LOG_NTP

NTP subsystem

LOG_HTTP

HTTP Server

LOG_SNMP

SNMP subsystem

LOG_RTCC

Real-Time Clock Service

LOG_CBOR

CBOR encoding and decoding  

LOG_UDP

UDP system

LOG_TCP

TCP system

LOG_DHCP

DHCP service

LOG_DNS

DNS service

LOG_LLDP

LLDP service

LOG_LINK

URI service  

LOG_LAST

To be kept at the end of the list

LOG_SEVERITY

enum LOG_SEVERITY

PRI Priorities severity.

LOG_EMERGENCY

System is unusable

LOG_ALERTS

Action must be taken immediately

LOG_CRITICAL

Critical conditions

LOG_ERROR

Error conditions

LOG_WARNING

Warning conditions

LOG_NOTICE

Normal but signification condition

LOG_INFO

Informational messages

LOG_DEBUG

Debug-level messages

2.9.4.20.10 Variable Documentation

LOG_Month

const char* LOG_Month[]

severityThresholdTable

const logFields_t severityThresholdTable[]

Sets the severity threshold for each facility.

2.9.4.21 source/log_console.c File Reference

This file provides the API implementation for sending log messages to the console.

#include <time.h>
#include <stdio.h>
#include <stdint.h>
#include "../../system/system.h"
#include "../log.h"
#include "../ip_database.h"

2.9.4.21.1 Functions

  • uint8_t logConsole (const char *message, uint8_t priorityVal)

    Logs a message to console using UART.

2.9.4.21.2 Detailed Description

This file provides the API implementation for sending log messages to the console.

Log Console Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.21.3 Function Documentation

logConsole()

uint8_t logConsole (const char * message, uint8_t priorityVal)

Logs a message to console using UART.

Parameters:
*message
priorityVal

Message priority

Return values:
1

2.9.4.22 source/log_console.h File Reference

This file provides the API implementation for sending log messages to the console.

2.9.4.22.1 Functions

  • uint8_t logConsole (const char *message, uint8_t priorityVal)

    Logs a message to console using UART.

2.9.4.22.2 Detailed Description

This file provides the API implementation for sending log messages to the console.

Log Console Header File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.22.3 Function Documentation

logConsole()

uint8_t logConsole (const char * message, uint8_t priorityVal)

Logs a message to console using UART.

Parameters:
*message
priorityVal

Message priority

Return values:
1

2.9.4.23 source/log_syslog.c File Reference

This file provides the API implementation for sending syslog messages.

#include <time.h>
#include <stdio.h>
#include <stdint.h>
#include "../../system/system.h"
#include "../log.h"
#include "../tcpip_types.h"
#include "../udpv4.h"
#include "../udpv4_port_handler_table.h"
#include "../ip_database.h"
#include "../log_syslog.h"

2.9.4.23.1 Functions

2.9.4.23.2 Detailed Description

This file provides the API implementation for sending syslog messages.

Sending Syslog Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.23.3 Function Documentation

logSyslog()

error_msg logSyslog (const char * message, uint8_t priorityVal)

Sends a syslog message.

Parameters:
*message
priorityVal

Message priority

Returns:

Status of sending the message. Refer to the error description in tcpip_types.h.

2.9.4.24 source/log_syslog.h File Reference

This file provides the API implementation for sending log messages using Ethernet (Syslog RFC 5424).

#include <stdint.h>
#include "tcpip_types.h"

2.9.4.24.1 Functions

2.9.4.24.3 Detailed Description

This file provides the API implementation for sending log messages using Ethernet (Syslog RFC 5424).

Log Syslog Header File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.24.4 Function Documentation

logSyslog()

error_msg logSyslog (const char * message, uint8_t priorityVal)

Sends a syslog message.

Parameters:
*message
priorityVal

Message priority

Returns:

Status of sending the message. Refer to the error description in tcpip_types.h.

2.9.4.24.5 Macro Definition Documentation

DESTPORT_SYSLOG

#define DESTPORT_SYSLOG 514

SOURCEPORT_SYSLOG

#define SOURCEPORT_SYSLOG 514

2.9.4.25 source/network.c File Reference

This file provides the network layer implementation for the TCP/IP stack.

#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include "../../system/system.h"
#include "../network.h"
#include "../tcpip_types.h"
#include "../dhcp_client.h"
#include "../arpv4.h"
#include "../ipv4.h"
#include "../tcpv4.h"
#include "../rtcc.h"
#include "../../ethernet/physical_layer_interface.h"
#include "../log.h"
#include "../lldp.h"
#include "../lldp_tlv_handler_table.h"
#include "../ip_database.h"
#include "../dns_client.h"

2.9.4.25.2 Macros

  • #define logMsg(msg, msgSeverity, msgLogDest)

2.9.4.25.4 Detailed Description

This file provides the network layer implementation for the TCP/IP stack.

Network Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.25.5 Function Documentation

Network_GetStartPosition()

uint16_t Network_GetStartPosition (void )

Returns the network start position.

Parameters:
None.
Returns:

Start position.

Network_Init()

void Network_Init (void )

Initializes the network protocols.

Parameters:
None.
Returns:

None.

Network_Manage()

void Network_Manage (void )

Handles the packets in the network.

Parameters:
None.
Returns:

None.

Network_Read()

void Network_Read (void )

Reads the packets in the network.

Parameters:
None.
Returns:

None.

Network_SaveStartPosition()

static void Network_SaveStartPosition (void )[static]

Network_WaitForLink()

void Network_WaitForLink (void )

Waits for the link by reading the PHY registers.

Parameters:
None.
Returns:

None.

timersInit()

void timersInit (void )

Initializes the timers.

Parameters:
None.
Returns:

None.

2.9.4.25.6 Macro Definition Documentation

logMsg

#define logMsg( msg, msgSeverity, msgLogDest)

2.9.4.25.7 Variable Documentation

arpTimer

time_t arpTimer

network_errors

const char* network_errors[]

Initial value:

= {
    "ERROR", "SUCCESS", "LINK_NOT_FOUND", "BUFFER_BUSY",
    "TX_LOGIC_NOT_IDLE", "MAC_NOT_FOUND",
    "IP_WRONG_VERSION", "IPV4_CHECKSUM_FAILS",
    "DEST_IP_NOT_MATCHED", "ICMP_CHECKSUM_FAILS",
    "UDP_CHECKSUM_FAILS", "TCP_CHECKSUM_FAILS",
    "DMA_TIMEOUT", "PORT_NOT_AVAILABLE",
    "ARP_IP_NOT_MATCHED", "EAPol_PACKET_FAILURE"}
networkStartPosition

uint16_t networkStartPosition

2.9.4.26 source/network.h File Reference

This file provides the network layer implementation for the Transmission Control Protocol/Internet Protocol (TCP/IP) stack.

#include <stdint.h>
#include "tcpip_types.h"

2.9.4.26.3 Detailed Description

This file provides the network layer implementation for the Transmission Control Protocol/Internet Protocol (TCP/IP) stack.

Network Header File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.26.4 Function Documentation

Network_GetStartPosition()

uint16_t Network_GetStartPosition (void )

Returns the network start position.

Parameters:
None.
Returns:

Start position.

Network_Init()

void Network_Init (void )

Initializes the network protocols.

Parameters:
None.
Returns:

None.

Network_Manage()

void Network_Manage (void )

Handles the packets in the network.

Parameters:
None.
Returns:

None.

Network_Read()

void Network_Read (void )

Reads the packets in the network.

Parameters:
None.
Returns:

None.

Network_WaitForLink()

void Network_WaitForLink (void )

Waits for the link by reading the PHY registers.

Parameters:
None.
Returns:

None.

timersInit()

void timersInit (void )

Initializes the timers.

Parameters:
None.
Returns:

None.

2.9.4.26.5 Macro Definition Documentation

byteReverse24

#define byteReverse24( a) (((((uint32_t)a & (uint32_t)0x00FF00) >> 8) | (((uint32_t)a & (uint32_t)0x0000FF) << 8)) << 8 | (uint32_t)a >> 0x10)

byteReverse32

#define byteReverse32( a)

Value:

((((uint32_t)a & (uint32_t)0xff000000) >> 24) | \
                          (((uint32_t)a & (uint32_t)0x00ff0000) >> 8)  | \
                          (((uint32_t)a & (uint32_t)0x0000ff00) << 8)  | \
                          (((uint32_t)a & (uint32_t)0x000000ff) << 24))
byteSwap16

#define byteSwap16( a) ((((uint16_t)a & (uint16_t)0xFF00) >> 8) | (((uint16_t)a & (uint16_t)0x00FF) << 8))

convert_hton24

#define convert_hton24( a) byteReverse24(a)

htonl

#define htonl( a) byteReverse32(a)

htons

#define htons( a) byteSwap16(a)

ntohl

#define ntohl( a) byteReverse32(a)

ntohs

#define ntohs( a) byteSwap16(a)

2.9.4.27 source/ntp.c File Reference

This file provides the API implementation of the NTP client protocol.

#include <stdio.h>
#include <string.h>
#include <time.h>
#include "../../system/system.h"
#include "../ntp.h"
#include "../udpv4.h"
#include "../rtcc.h"
#include "../log.h"
#include "../ip_database.h"

2.9.4.27.1 Functions

  • void NTP_Request (void)

    Sends the NTP request to the NTP server.

  • void NTP_Handler (int16_t length)

    Receives and processes the NTP packet.

2.9.4.27.2 Macros

  • #define logMsg(msg, msgSeverity, msgLogDest)

  • #define NTP_PACKET_SIZE 48

  • #define NTP_TIME_OFFSET 2208988800

    The time offset converts from unix time (seconds, since January 1, 1970) to RFC 868 time (seconds, since January 1, 1900). The RFC indicates that this is sufficient until 2036.

2.9.4.27.3 Detailed Description

This file provides the API implementation of the NTP client protocol.

NTP client Implementation Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.27.4 Macro Definition Documentation

logMsg

#define logMsg( msg, msgSeverity, msgLogDest)

NTP_PACKET_SIZE

#define NTP_PACKET_SIZE 48

2.9.4.28 source/ntp.h File Reference

#include <time.h>
#include <stdint.h>

2.9.4.28.1 Functions

  • void NTP_Request (void)

    Sends the NTP request to the NTP server.

  • void NTP_Handler (int16_t length)

    Receives and processes the NTP packet.

2.9.4.28.2 Detailed Description

NTP Client Protocol Header File

2.9.4.29 source/rtcc.c File Reference

This file provides the API implementation for the RTCC.

#include <time.h>
#include <stdint.h>
#include <stdbool.h>
#include "../rtcc.h"
#include "../../system/system.h"

2.9.4.29.1 Functions

  • void rtcc_init (void)

    Initializes the clock calendar driver. This routine configures the basics of a software-driven RTCC peripheral. It relies upon a periodic timer event to provide time keeping. The appropriate timer needs to be selected in the TCP/IP Lite Dependency. Configure the selected timer to produce a time-out of 1s. Set the callback rate as 1, if required depending on the device.

  • void rtcc_handler (void)

    Maintains the deviceTime (seconds) using the LCDIF flag/interrupt. This routine decrements seconds_counter until 0 and then increments deviceTime. seconds_counter reloads with CLOCK_PER_SEC. It uses the timer selected as the Dependency by the user.

  • void rtcc_set (time_t *t)

    Sets the device time to the passed unix time value and updates the device time with the passed unix time. Interrupts are disabled during the copy and restored to the original on exit.

  • time_t time (time_t *t)

    Returns the current device time. This routine retrieves the device time as either a return value or filling in a variable passed by reference. Interrupts are disabled during the copy and restored to the original on exit. time.h is a prerequisite for supporting the standard C time libraries and does not implement time, as it is application dependent.

2.9.4.29.3 Detailed Description

This file provides the API implementation for the RTCC.

RTCC Implementation Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.29.4 Function Documentation

rtcc_handler()

void rtcc_handler (void )

Maintains the deviceTime (seconds) using the LCDIF flag/interrupt. This routine decrements seconds_counter until 0 and then increments deviceTime. seconds_counter reloads with CLOCK_PER_SEC. It uses the timer selected as the Dependency by the user.

Parameters:
None.
Returns:

None.

rtcc_init()

void rtcc_init (void )

Initializes the clock calendar driver. This routine configures the basics of a software-driven RTCC peripheral. It relies upon a periodic timer event to provide time keeping. The appropriate timer needs to be selected in the TCP/IP Lite Dependency. Configure the selected timer to produce a time-out of 1s. Set the callback rate as 1, if required depending on the device.

Parameters:
None.
Returns:

None.

rtcc_set()

void rtcc_set (time_t * t)

Sets the device time to the passed unix time value and updates the device time with the passed unix time. Interrupts are disabled during the copy and restored to the original on exit.

Parameters:
*t

A pointer of type time_t for the current time

Returns:

None.

time()

time_t time (time_t * t)

Returns the current device time. This routine retrieves the device time as either a return value or filling in a variable passed by reference. Interrupts are disabled during the copy and restored to the original on exit. time.h is a prerequisite for supporting the standard C time libraries and does not implement time, as it is application dependent.

Parameters:
*t

A pointer of type time_t for the current time

Returns:

Value of the current time.

2.9.4.29.5 Variable Documentation

deviceTime

volatile time_t deviceTime

dirtyTime

volatile bool dirtyTime

seconds_counter

volatile uint16_t seconds_counter

2.9.4.30 source/rtcc.h File Reference

This file provides the API implementation for the Real-Time Clock/Calendar (RTCC).

#include <time.h>
#include <stdint.h>

2.9.4.30.1 Functions

  • void rtcc_init (void)

    Initializes the clock calendar driver. This routine configures the basics of a software-driven RTCC peripheral. It relies upon a periodic timer event to provide time keeping. The appropriate timer needs to be selected in the TCP/IP Lite Dependency. Configure the selected timer to produce a time-out of 1s. Set the callback rate as 1, if required depending on the device.

  • void rtcc_handler (void)

    Maintains the deviceTime (seconds) using the LCDIF flag/interrupt. This routine decrements seconds_counter until 0 and then increments deviceTime. seconds_counter reloads with CLOCK_PER_SEC. It uses the timer selected as the Dependency by the user.

  • void rtcc_set (time_t *t)

    Sets the device time to the passed unix time value and updates the device time with the passed unix time. Interrupts are disabled during the copy and restored to the original on exit.

  • time_t time (time_t *t)

    Returns the current device time. This routine retrieves the device time as either a return value or filling in a variable passed by reference. Interrupts are disabled during the copy and restored to the original on exit. time.h is a prerequisite for supporting the standard C time libraries and does not implement time, as it is application dependent.

2.9.4.30.2 Variables

2.9.4.30.3 Detailed Description

This file provides the API implementation for the Real-Time Clock/Calendar (RTCC).

RTCC Header File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.30.4 Function Documentation

rtcc_handler()

void rtcc_handler (void )

Maintains the deviceTime (seconds) using the LCDIF flag/interrupt. This routine decrements seconds_counter until 0 and then increments deviceTime. seconds_counter reloads with CLOCK_PER_SEC. It uses the timer selected as the Dependency by the user.

Parameters:
None.
Returns:

None.

rtcc_init()

void rtcc_init (void )

Initializes the clock calendar driver. This routine configures the basics of a software-driven RTCC peripheral. It relies upon a periodic timer event to provide time keeping. The appropriate timer needs to be selected in the TCP/IP Lite Dependency. Configure the selected timer to produce a time-out of 1s. Set the callback rate as 1, if required depending on the device.

Parameters:
None.
Returns:

None.

rtcc_set()

void rtcc_set (time_t * t)

Sets the device time to the passed unix time value and updates the device time with the passed unix time. Interrupts are disabled during the copy and restored to the original on exit.

Parameters:
*t

A pointer of type time_t for the current time

Returns:

None.

time()

time_t time (time_t * t)

Returns the current device time. This routine retrieves the device time as either a return value or filling in a variable passed by reference. Interrupts are disabled during the copy and restored to the original on exit. time.h is a prerequisite for supporting the standard C time libraries and does not implement time, as it is application dependent.

Parameters:
*t

A pointer of type time_t for the current time

Returns:

Value of the current time.

2.9.4.30.5 Variable Documentation

dirtyTime

volatile bool dirtyTime

2.9.4.31 source/tcpip_config.h File Reference

This file provides the API implementation for the TCP/IP Stack user configuration options.

2.9.4.31.1 Macros

2.9.4.31.2 Variables

2.9.4.31.3 Detailed Description

This file provides the API implementation for the TCP/IP Stack user configuration options.

TCP/IP Stack User Configuration Options Header File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.31.4 Macro Definition Documentation

ARP_MAP_SIZE

#define ARP_MAP_SIZE 8

DHCP_NAME_SIZE

#define DHCP_NAME_SIZE 20

Required since sizeof is not handled during the preprocessor stage.

IPv4_TTL

#define IPv4_TTL 64u

LOCAL_TCP_PORT_END_NUMBER

#define LOCAL_TCP_PORT_END_NUMBER (65535u)

The highest port number to be used as a local port.

LOCAL_TCP_PORT_START_NUMBER

#define LOCAL_TCP_PORT_START_NUMBER (1024u)

The lower port number to be used as a local port.

MAKE_IPV4_ADDRESS

#define MAKE_IPV4_ADDRESS( a, b, c, d) ((uint32_t)(((uint32_t)a << 24) | ((uint32_t)b<<16) | ((uint32_t)c << 8) | (uint32_t)d))

Build the IPv4 Address.

SOURCEPORT_TFTP

#define SOURCEPORT_TFTP 65531

TCP_MAX_RETRIES

#define TCP_MAX_RETRIES (5u)

Number of retransmission attempts.

TCP_MAX_SEG_SIZE

#define TCP_MAX_SEG_SIZE 1460u

TCP maximum segment size.

TCP_MAX_SYN_RETRIES

#define TCP_MAX_SYN_RETRIES (3u)

than all other retries to reduce SYN flood DoS duration

TCP_START_TIMEOUT_VAL

#define TCP_START_TIMEOUT_VAL ((unsigned long)TICK_SECOND*2)

Time-out to retransmit unacked data.

TICK_SECOND

#define TICK_SECOND 1

2.9.4.31.5 Variable Documentation

dhcpName

const char dhcpName[]

2.9.4.32 source/tcpip_types.h File Reference

This file provides the TCP/IP Stack type definitions.

#include <stdint.h>

2.9.4.32.2 Macros

2.9.4.32.4 Enumerations

2.9.4.32.6 Detailed Description

This file provides the TCP/IP Stack type definitions.

TCP/IP Stack User Types Header File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.32.7 Macro Definition Documentation

AF_INET

#define AF_INET 2

Internet IP Protocol.

AF_INET6

#define AF_INET6 10

IP version 6.

ETHERNET_ADDR_LEN

#define ETHERNET_ADDR_LEN 6

ETHERTYPE_ARP

#define ETHERTYPE_ARP 0x0806

ETHERTYPE_EAPoL

#define ETHERTYPE_EAPoL 0x888E

ETHERTYPE_IPV4

#define ETHERTYPE_IPV4 0x0800

ETHERTYPE_IPV6

#define ETHERTYPE_IPV6 0x86DD

ETHERTYPE_LLDP

#define ETHERTYPE_LLDP 0x88CC

ETHERTYPE_VLAN

#define ETHERTYPE_VLAN 0x8100

IN6ADDR_ANY_INIT

#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }

IN6ADDR_LOOPBACK_INIT

#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }

INET6_ADDRSTRLEN

#define INET6_ADDRSTRLEN 46

Length of the string form for IPv6.

INET_ADDRSTRLEN

#define INET_ADDRSTRLEN 16

Length of the string form for IP.

INETADDRESSTYPE_DNS

#define INETADDRESSTYPE_DNS 16

INETADDRESSTYPE_IPV4

#define INETADDRESSTYPE_IPV4 1

INETADDRESSTYPE_IPV6

#define INETADDRESSTYPE_IPV6 2

IP_ADDR_LEN

#define IP_ADDR_LEN 4

PF_INET

#define PF_INET AF_INET

Protocol families, same as address families.

PF_INET6

#define PF_INET6 AF_INET6

2.9.4.32.8 Typedef Documentation

ip_receive_function_ptr

ip_receive_function_ptr

Function pointer to the function that receives the payload.

Parameters:
int16_t

Available bytes for the payload

Returns:

None.

socklistsize_t

typedef int8_t socklistsize_t

2.9.4.32.9 Enumeration Type Documentation

error_msg

enum error_msg

Error message.

ERROR
SUCCESS
LINK_NOT_FOUND
BUFFER_BUSY
TX_LOGIC_NOT_IDLE
TX_QUEUED
DMA_TIMEOUT
MAC_NOT_FOUND
IP_WRONG_VERSION
IPV4_CHECKSUM_FAILS
DEST_IP_NOT_MATCHED
ICMP_CHECKSUM_FAILS
UDP_CHECKSUM_FAILS
TCP_CHECKSUM_FAILS
PORT_NOT_AVAILABLE
ARP_IP_NOT_MATCHED
EAPoL_PACKET_FAILURE
INCORRECT_IPV4_HLEN
IPV4_NO_OPTIONS
IPV6_CHECKSUM_FAILS
IPV6_LOCAL_ADDR_RESOLVE
IPV6_LOCAL_ADDR_INVALID
NO_GATEWAY
ADDRESS_RESOLUTION
GLOBAL_DESTINATION
ARP_WRONG_HARDWARE_ADDR_TYPE
ARP_WRONG_PROTOCOL_TYPE
ARP_WRONG_HARDWARE_ADDR_LEN
ARP_WRONG_PROTOCOL_LEN
icmpTypeCodes_t

enum icmpTypeCodes_t

ICMP Types and Codes.

ECHO_REPLY

Echo reply

DEST_NETWORK_UNREACHABLE

Destination network unreachable  

DEST_HOST_UNREACHABLE

Destination host unreachable

DEST_PROTOCOL_UNREACHABLE

Destination protocol unreachable

DEST_PORT_UNREACHABLE

Destination port unreachable

FRAGMENTATION_REQUIRED

Fragmentation required

SOURCE_ROUTE_FAILED

Fragmentation failed

DESTINATION_NETWORK_UNKNOWN

Unknown destination network

SOURCE_HOST_ISOLATED

Source host isolated

NETWORK_ADMINISTRATIVELY_PROHIBITED

Network administratively prohibited

HOST_ADMINISTRATIVELY_PROHIBITED

Host administratively prohibited

NETWORK_UNREACHABLE_FOR_TOS

Network unreachable for TOS

HOST_UNREACHABLE_FOR_TOS

Host unreachable for TOS

COMMUNICATION_ADMINISTRATIVELY_PROHIBITED

Communication administratively prohibited

HOST_PRECEDENCE_VIOLATION

Host precedence violation

PRECEDENCE_CUTOFF_IN_EFFECT

Precedence cutoff in effect

SOURCE_QUENCH

Source quench

REDIRECT_DATAGRAM_FOR_THE_NETWORK

Redirect message for the network

REDIRECT_DATAGRAM_FOR_THE_HOST

Redirect message for the host

REDIRECT_DATAGRAM_FOR_THE_TOS_AND_NETWORK

Redirect message for the TOS and network

REDIRECT_DATAGRAM_FOR_THE_TOS_AND_HOST

Redirect message for the TOS and host

ALTERNATE_HOST_ADDRESS

Alternate host address

ECHO_REQUEST

Echo Request: Ask for a ping!

UNASSIGNED_ECHO_TYPE_CODE_REQUEST_1

Unassigned codes

UNASSIGNED_ECHO_TYPE_CODE_REQUEST_2

Unassigned codes

ROUTER_ADVERTISEMENT

Router advertisement

ROUTER_SOLICITATION

Router solicitaion

TRACEROUTE

Trace route

ipProtocolNumbers

enum ipProtocolNumbers

IP Protocol Numbers. List from RFC5237 http://www.iana.org/assignments/protocol-numbers/protocol-numbers.txt.

HOPOPT_TCPIP

IPv6 Hop-by-Hop Option [RFC2460]

ICMP_TCPIP

Internet Control Message [RFC792]

IGMP_TCPIP

Internet Group Management [RFC1112]

GGP_TCPIP

Gateway-to-Gateway [RFC823]

IPV4_TCPIP

IPv4 encapsulation [RFC2003]

ST_TCPIP

Stream [RFC1190][RFC1819]

TCP_TCPIP

Transmission Control [RFC793]

CBT_TCPIP

CBT [Tony_Ballardie]

EGP_TCPIP

Exterior Gateway Protocol [RFC888][David_Mills]

IGP_TCPIP

Any private interior gateway (used by Cisco for their IGRP) [Internet_Assigned_Numbers_Authority]

BBN_RCC_MON_TCPIP

BBN RCC Monitoring [Steve_Chipman]

NVP_II_TCPIP

Network Voice Protocol [RFC741][Steve_Casner]

PUP_TCPIP

PUP [Boggs, D., J. Shoch, E. Taft, and R. Metcalfe, "PUP: An Internetwork Architecture", XEROX Palo Alto Research Center, CSL-79-10, July 1979; also in IEEE Transactions on Communication, Volume COM-28, Number 4, April 1980.][[XEROX]]

ARGUS_TCPIP

ARGUS [Robert_W_Scheifler]

EMCON_TCPIP

EMCON [<mystery contact>="">]

XNET_TCPIP

Cross Net Debugger [Haverty, J., "XNET Formats for Internet Protocol Version 4", IEN 158, October 1980.][Jack_Haverty]

CHAOS_TCPIP

Chaos [J_Noel_Chiappa]

UDP_TCPIP

User Datagram [RFC768][Jon_Postel]

MUX_TCPIP

Multiplexing [Cohen, D. and J. Postel, "Multiplexing Protocol", IEN 90, USC/Information Sciences Institute, May 1979.][Jon_Postel]

DCN_MEAS_TCPIP

DCN Measurement Subsystems [David_Mills]

HMP_TCPIP

Host Monitoring [RFC869][Robert_Hinden]

PRM_TCPIP

Packet Radio Measurement [Zaw_Sing_Su]

XNS_IDP_TCPIP

XEROX NS IDP ["The Ethernet, A Local Area Network: Data Link Layer and Physical Layer Specification", AA-K759B-TK, Digital Equipment Corporation, Maynard, MA. Also as: "The Ethernet - A Local Area Network", Version 1.0, Digital Equipment Corporation, Intel Corporation, Xerox Corporation, September 1980. And: "The Ethernet, A Local Area Network: Data Link Layer and Physical Layer Specifications", Digital, Intel and Xerox, November 1982. And: XEROX, "The Ethernet, A Local Area Network: Data Link Layer and Physical Layer Specification", X3T51/80-50, Xerox Corporation, Stamford, CT., October 1980.][[XEROX]]

TRUNK_1_TCPIP

Trunk-1 [Barry_Boehm]

TRUNK_2_TCPIP

Trunk-2 [Barry_Boehm]

LEAF_1_TCPIP

Leaf-1 [Barry_Boehm]

LEAF_2_TCPIP

Leaf-2 [Barry_Boehm]

RDP_TCPIP

Reliable Data Protocol [RFC908][Robert_Hinden]

IRTP_TCPIP

Internet Reliable Transaction [RFC938][Trudy_Miller]

ISO_TP4_TCPIP

ISO Transport Protocol Class 4 [RFC905][<mystery contact>="">]

NETBLT_TCPIP

Bulk Data Transfer Protocol [RFC969][David_Clark]

MFE_NSP_TCPIP

MFE Network Services Protocol [Shuttleworth, B., "A Documentary of MFENet, a National Computer Network", UCRL-52317, Lawrence Livermore Labs, Livermore, California, June 1977.][Barry_Howard]

MERIT_INP_TCPIP

MERIT Internodal Protocol [Hans_Werner_Braun]

DCCP_TCPIP

Datagram Congestion Control Protocol [RFC4340]

THREEPC_TCPIP

Third Party Connect Protocol [Stuart_A_Friedberg]

IDPR_TCPIP

Inter-Domain Policy Routing Protocol [Martha_Steenstrup]

XTP_TCPIP

XTP [Greg_Chesson]

DDP_TCPIP

Datagram Delivery Protocol [Wesley_Craig]

IDPR_CMTP_TCPIP

IDPR Control Message Transport Proto [Martha_Steenstrup]

TPpp_TCPIP

TP++ Transport Protocol [Dirk_Fromhein]

IL_TCPIP

IL Transport Protocol [Dave_Presotto]

IPV6_TUNNEL_TCPIP

IPv6 encapsulation [RFC2473]

SDRP_TCPIP

Source Demand Routing Protocol [Deborah_Estrin]

IPV6_Route_TCPIP

Routing Header for IPv6 [Steve_Deering]

IPV6_Frag_TCPIP

Fragment Header for IPv6 [Steve_Deering]

IDRP_TCPIP

Inter-Domain Routing Protocol [Sue_Hares]

RSVP_TCPIP

Reservation Protocol [RFC2205][RFC3209][Bob_Braden]

GRE_TCPIP

Generic Routing Encapsulation [RFC1701][Tony_Li]

DSR_TCPIP

Dynamic Source Routing Protocol [RFC4728]

BNA_TCPIP

BNA [Gary Salamon]

ESP_TCPIP

Encap Security Payload RFC4303]

AH_TCPIP

Authentication Header [RFC4302]

I_NLSP_TCPIP

Integrated Net Layer Security TUBA [K_Robert_Glenn]

SWIPE_TCPIP

IP with Encryption [John_Ioannidis]

NARP_TCPIP

NBMA Address Resolution Protocol [RFC1735]

MOBILE_TCPIP

IP Mobility [Charlie_Perkins]

TLSP_TCPIP

Transport Layer Security Protocol using Kryptonet key management [Christer_Oberg]

SKIP_TCPIP

SKIP [Tom_Markson]

IPV6_ICMP_TCPIP

ICMP for IPv6 [RFC2460]

IPV6_NoNxt_TCPIP

No Next Header for IPv6 [RFC2460]

IPV6_Opts_TCPIP

Destination Options for IPv6 [RFC2460]

CFTP_TCPIP

CFTP [Forsdick, H., "CFTP", Network Message, Bolt Beranek and Newman, January 1982.][Harry_Forsdick]

SAT_EXPAK_TCPIP

SATNET and Backroom EXPAK [Steven_Blumenthal]

KRYPTOLAN_TCPIP

Kryptolan [Paul Liu]

RVD_TCPIP

MIT Remote Virtual Disk Protocol [Michael_Greenwald]

IPPC_TCPIP

Internet Pluribus Packet Core [Steven_Blumenthal]

SAT_MON_TCPIP

SATNET Monitoring [Steven_Blumenthal]

VISA_TCPIP

VISA Protocol [Gene_Tsudik]

IPCV_TCPIP

Internet Packet Core Utility [Steven_Blumenthal]

CPNX_TCPIP

Computer Protocol Network Executive [David Mittnacht]

CPHB_TCPIP

Computer Protocol Heart Beat [David Mittnacht]

WSN_TCPIP

Wang Span Network [Victor Dafoulas]

PVP_TCPIP

Packet Video Protocol [Steve_Casner]

BR_SAT_MON_TCPIP

Backroom SATNET Monitoring [Steven_Blumenthal]

SUN_ND_TCPIP

SUN ND PROTOCOL-Temporary [William_Melohn]

WB_MON_TCPIP

WIDEBAND Monitoring [Steven_Blumenthal]

WB_EXPAK_TCPIP

WIDEBAND EXPAK [Steven_Blumenthal]

ISO_IP_TCPIP

ISO Internet Protocol [Marshall_T_Rose]

VMTP_TCPIP

VMTP [Dave_Cheriton]

SECURE_VMTP_TCPIP

SECURE-VMTP [Dave_Cheriton]

VINES_TCPIP

VINES [Brian Horn]

TTP_TCPIP

TTP [Jim_Stevens]

IPTM_TCPIP

Protocol Internet Protocol Traffic Manager [Jim_Stevens]

NSFNET_IGP_TCPIP

NSFNET-IGP [Hans_Werner_Braun]

DGP_TCPIP

Dissimilar Gateway Protocol [M/A-COM Government Systems, "Dissimilar Gateway Protocol Specification, Draft Version", Contract no. CS901145, November 16, 1987.][Mike_Little]

TCF_TCPIP

TCF [Guillermo_A_Loyola]

EIGRP_TCPIP

EIGRP [Cisco Systems, "Gateway Server Reference Manual", Manual Revision B, January 10, 1988.][Guenther_Schreiner]

OSPFIGP_TCPIP

OSPFIGP [RFC1583][RFC2328][RFC5340][John_Moy]

Sprite_RPC_TCPIP

Sprite RPC Protocol [Welch, B., "The Sprite Remote Procedure Call System", Technical Report, UCB/Computer Science Dept., 86/302, University of California at Berkeley, June 1986.][Bruce Willins]

LARP_TCPIP

Locus Address Resolution Protocol [Brian Horn]

MTP_TCPIP

Multicast Transport Protocol [Susie_Armstrong]

AX25_TCPIP

AX.25 Frames [Brian_Kantor]

IPIP_TCPIP

IP-within-IP Encapsulation Protocol [John_Ioannidis]

MICP_TCPIP

Mobile Internetworking Control Pro. [John_Ioannidis]

SCC_SP_TCPIP

Semaphore Communications Sec. Pro. [Howard_Hart]

ETHERIP_TCPIP

Ethernet-within-IP Encapsulation [RFC3378]

ENCAP_TCPIP

Encapsulation Header [RFC1241][Robert_Woodburn]

GMTP_TCPIP

GMTP [[RXB5]]

IFMP_TCPIP

Ipsilon Flow Management Protocol [Bob_Hinden][November 1995, 1997.]

PNNI_TCPIP

PNNI over IP [Ross_Callon]

PIM_TCPIP

Protocol Independent Multicast [RFC4601][Dino_Farinacci]

ARIS_TCPIP

ARIS [Nancy_Feldman]

SCPS_TCPIP

SCPS [Robert_Durst]

QNX_TCPIP

QNX [Michael_Hunter]

A_N_TCPIP

Active Networks [Bob_Braden]

IPComp_TCPIP

IP Payload Compression Protocol [RFC2393]

SNP_TCPIP

Sitara Networks Protocol [Manickam_R_Sridhar]

Compaq_Peer_TCPIP

Compaq Peer Protocol [Victor_Volpe]

IPX_in_IP_TCPIP

IPX in IP [CJ_Lee]

VRRP_TCPIP

Virtual Router Redundancy Protocol [RFC5798]

PGM_TCPIP

PGM Reliable Transport Protocol [Tony_Speakman]

L2TP_TCPIP

Layer Two Tunneling Protocol [RFC3931][Bernard_Aboba]

DDX_TCPIP

D-II Data Exchange (DDX) [John_Worley]

IATP_TCPIP

Interactive Agent Transfer Protocol [John_Murphy]

STP_TCPIP

Schedule Transfer Protocol [Jean_Michel_Pittet]

SRP_TCPIP

SpectraLink Radio Protocol [Mark_Hamilton]

UTI_TCPIP

UTI [Peter_Lothberg]

SMP_TCPIP

Simple Message Protocol [Leif_Ekblad]

SM_TCPIP

SM [Jon_Crowcroft]

PTP_TCPIP

Performance Transparency Protocol [Michael_Welzl]

ISIS_TCPIP

Over IPv4 [Tony_Przygienda]

FIRE_TCPIP

[Criag_Partridge]

CRTP_TCPIP

Combat Radio Transport Protocol [Robert_Sautter]

CRUDP_TCPIP

Combat Radio User Datagram [Robert_Sautter]

SSCOPMCE_TCPIP

[Kurt_Waber]

IPLT_TCPIP

[[Hollbach]]

SPS_TCPIP

Secure Packet Shield [Bill_McIntosh]

PIPE_TCPIP

Private IP Encapsulation within IP [Bernhard_Petri]

SCTP_TCPIP

Stream Control Transmission Protocol [Randall_R_Stewart]

FC_TCPIP

Fibre Channel [Murali_Rajagopal][RFC6172]

tcbError_t

enum tcbError_t

TCB_ERROR
TCB_NO_ERROR

2.9.4.32.10 Variable Documentation

network_errors

const char* network_errors[]

2.9.4.33 source/tcpv4.c File Reference

This file provides the API implementation for the TCPv4 stack.

#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include "../ipv4.h"
#include "../tcpv4.h"
#include "../network.h"
#include "../../ethernet/physical_layer_interface.h"
#include "../tcpip_types.h"
#include "../log.h"
#include "../tcpip_config.h"
#include "../icmp.h"

2.9.4.33.1 Functions

  • static error_msg TCP_FiniteStateMachine (void)

    TCP stack state machine called upon the occurrence of each event (e.g., opening/closing a connection, receiving a TCP packet).

  • static error_msg TCP_TimoutRetransmit (void)

    Retransmits TCP packets after timeout.

  • static void TCB_Insert (tcpTCB_t *ptr)

    Inserts a pointer to the new TCB into the TCB pointer list.

  • static void TCB_Remove (tcpTCB_t *ptr)

    Removes a pointer to a TCB from the TCB pointer list and connects its adjacent items together.

  • static void TCB_Reset (tcpTCB_t *tcbPtr)

    Resets the socket to a known state.

  • static error_msg TCB_Check (tcpTCB_t *ptr)

    Check if there is a pointer to a socket/TCB. If the pointer is in the TCB list, then it is a valid socket.

  • static error_msg TCP_Snd (tcpTCB_t *tcbPtr)

    Internal function of the TCP stack to send a TCP packet.

  • error_msg TCP_PayloadSave (uint16_t len)

    Copies the TCP packet payload to the socket RX buffer. This routine also sends the ACK for the received packet and any data ready to be sent.

  • static error_msg TCP_ParseTCPOptions (void)

    Reads and parses the Options field in the TCP header. This routine reads only the ones that have SYN or SYN + ACK. For the other TCP headers the field will be skipped.

  • void TCP_Recv (uint32_t remoteAddress, uint16_t length)

    Identifies the destination socket and parses the TCP header. This routine is called by the IP layer for each received TCP packet.

  • void TCP_Init (void)

    Initializes TCP structures, meaning certain internal TCP stack variables.

  • error_msg TCP_SocketInit (tcpTCB_t *tcbPtr)

    Initializes the TCB and adds it to the list of TCB pointers. The socket needs to be put in the Closed state. The user is responsible to manage memory allocation and release.

  • error_msg TCP_SocketRemove (tcpTCB_t *tcbPtr)

    Removes the socket pointer from the TCP stack, and the list of TCB pointers, respectively. After calling this routine the memory is ready to be used again.

  • socketState_t TCP_SocketPoll (tcpTCB_t *socket_ptr)

    Provides an interface to read the status of the socket. This routine also checks if the pointer is already in the TCB list. This means that the socket is "in use". If the socket is in the TCB list, the socket status will be returned.

  • error_msg TCP_Bind (tcpTCB_t *tcbPtr, uint16_t port)

    Assigns a port number to the specified socket. This is used for configuring the local port of a socket.

  • error_msg TCP_Listen (tcpTCB_t *tcbPtr)

    Listens for connections on a socket. This routine marks the socket as passive, meaning that it will be used to accept incoming connection requests.

  • error_msg TCP_Connect (tcpTCB_t *tcbPtr, sockaddr_in4_t *srvaddr)

    Starts the client for a particular socket.

  • error_msg TCP_Close (tcpTCB_t *tcbPtr)

    Closes the TCP connection. This initiates the closing sequence for the TCP connection.

  • error_msg TCP_Send (tcpTCB_t *tcbPtr, uint8_t *data, uint16_t dataLen)

    Sends a buffer to a remote machine using a TCP connection. This routine adds the buffer to the socket and the payload is sent as soon as possible.

  • error_msg TCP_SendDone (tcpTCB_t *tcbPtr)

    Checks if the TX buffer was sent. This means that the data was received correctly by the remote machine and the TX buffer memory can be reused by the application.

  • error_msg TCP_InsertRxBuffer (tcpTCB_t *tcbPtr, uint8_t *data, uint16_t data_len)

    Adds the RX buffer to the socket.

  • int16_t TCP_GetReceivedData (tcpTCB_t *tcbPtr)

    Reads the available data from the socket. This routine provides the start address of the received buffer to the user.

  • int16_t TCP_GetRxLength (tcpTCB_t *tcbPtr)

    Checks and returns the number of available bytes received on a socket.

  • void TCP_Update (void)

    Handles the TCP stack time-outs for each available socket. This routine needs to be called periodically.

2.9.4.33.2 Macros

  • #define logMsg(msg, msgSeverity, msgLogDest)

2.9.4.33.4 Detailed Description

This file provides the API implementation for the TCPv4 stack.

Transmission Control Protocol version4 (TCPv4) Implementation Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.33.5 Macro Definition Documentation

logMsg

#define logMsg( msg, msgSeverity, msgLogDest)

2.9.4.33.6 Variable Documentation

bytesToSendForRetransmit

uint16_t bytesToSendForRetransmit = 0[static]

currentTCB

tcpTCB_t* currentTCB

lastAckNumber

uint32_t lastAckNumber[static]

localSeqnoForRetransmit

uint32_t localSeqnoForRetransmit[static]

nextAvailablePort

uint16_t nextAvailablePort[static]

nextSequenceNumber

uint32_t nextSequenceNumber[static]

rcvPayloadLen

uint16_t rcvPayloadLen[static]

receivedRemoteAddress

uint32_t receivedRemoteAddress[static]

tcbList

tcpTCB_t* tcbList

tcbListSize

socklistsize_t tcbListSize

tcpDataLength

uint16_t tcpDataLength[static]

tcpHeader

tcpHeader_t tcpHeader[static]

tcpMss

uint16_t tcpMss = 536[static]

txBufferPtrForRetransmit

uint8_t* txBufferPtrForRetransmit[static]

2.9.4.34 source/tcpv4.h File Reference

#include <stdbool.h>
#include "tcpip_types.h"

2.9.4.34.1 Data structures

2.9.4.34.2 Functions

  • void TCP_Init (void)

    Initializes TCP structures, meaning certain internal TCP stack variables.

  • error_msg TCP_SocketInit (tcpTCB_t *tcbPtr)

    Initializes the TCB and adds it to the list of TCB pointers. The socket needs to be put in the Closed state. The user is responsible to manage memory allocation and release.

  • error_msg TCP_SocketRemove (tcpTCB_t *tcbPtr)

    Removes the socket pointer from the TCP stack, and the list of TCB pointers, respectively. After calling this routine the memory is ready to be used again.

  • socketState_t TCP_SocketPoll (tcpTCB_t *socket_ptr)

    Provides an interface to read the status of the socket. This routine also checks if the pointer is already in the TCB list. This means that the socket is "in use". If the socket is in the TCB list, the socket status will be returned.

  • error_msg TCP_Bind (tcpTCB_t *tcbPtr, uint16_t port)

    Assigns a port number to the specified socket. This is used for configuring the local port of a socket.

  • error_msg TCP_Listen (tcpTCB_t *tcbPtr)

    Listens for connections on a socket. This routine marks the socket as passive, meaning that it will be used to accept incoming connection requests.

  • error_msg TCP_Connect (tcpTCB_t *tcbPtr, sockaddr_in4_t *srvaddr)

    Starts the client for a particular socket.

  • error_msg TCP_Close (tcpTCB_t *tcbPtr)

    Closes the TCP connection. This initiates the closing sequence for the TCP connection.

  • error_msg TCP_Send (tcpTCB_t *tcbPtr, uint8_t *data, uint16_t dataLen)

    Sends a buffer to a remote machine using a TCP connection. This routine adds the buffer to the socket and the payload is sent as soon as possible.

  • error_msg TCP_SendDone (tcpTCB_t *tcbPtr)

    Checks if the TX buffer was sent. This means that the data was received correctly by the remote machine and the TX buffer memory can be reused by the application.

  • error_msg TCP_InsertRxBuffer (tcpTCB_t *tcbPtr, uint8_t *data, uint16_t data_len)

    Adds the RX buffer to the socket.

  • int16_t TCP_GetReceivedData (tcpTCB_t *tcbPtr)

    Reads the available data from the socket. This routine provides the start address of the received buffer to the user.

  • int16_t TCP_GetRxLength (tcpTCB_t *tcbPtr)

    Checks and returns the number of available bytes received on a socket.

  • void TCP_Update (void)

    Handles the TCP stack time-outs for each available socket. This routine needs to be called periodically.

2.9.4.34.4 Enumerations

2.9.4.34.5 Detailed Description

Transmission Control Protocol (TCP) v4 Header File

2.9.4.34.6 Macro Definition Documentation

TCP_ACK_FLAG

#define TCP_ACK_FLAG 0x10U

TCP_CWR_FLAG

#define TCP_CWR_FLAG 0x80U

TCP_ECE_FLAG

#define TCP_ECE_FLAG 0x40U

TCP_FIN_FLAG

#define TCP_FIN_FLAG 0x01U

TCP_PSH_FLAG

#define TCP_PSH_FLAG 0x08U

TCP_RST_FLAG

#define TCP_RST_FLAG 0x04U

TCP_SYN_FLAG

#define TCP_SYN_FLAG 0x02U

TCP_URG_FLAG

#define TCP_URG_FLAG 0x20U

2.9.4.35 source/tftp.c File Reference

This file provides the API implementation of the TFTP client.

#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include "../tcpip_types.h"
#include "../tcpip_config.h"
#include "../tftp.h"
#include "../tftp_handler_table.h"
#include "../udpv4.h"

2.9.4.35.1 Functions

  • void TFTP_Configure (uint32_t tftp_server_address, char *tftp_filename, char *tftp_block_size)

    Allows the user to configure the TFTP server options.

  • error_msg TFTP_Read_Write_Request (uint8_t opcode)

    Sends a read or write request to the TFTP server depending on the opcode.

  • void TFTP_Ack (uint8_t opcode)

    Sends an acknowledgement on receiving a packet from a TFTP Server.

  • void TFTP_Handler (int16_t length)

    Processes a TFTP message as per the opcode in the packet.

  • void Process_TFTP_Data (uint32_t address, char *data, uint16_t length)

    Processes TFTP packets with 'data' opcode and blocks of the specified size. Depending on TFTP_callBackTable, the storage can be in EEPROM, Flash, etc.

2.9.4.35.4 Detailed Description

This file provides the API implementation of the TFTP client.

TFTP client Implementation Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.35.5 Macro Definition Documentation

TFTP_BLOCK_SIZE

#define TFTP_BLOCK_SIZE 2

TFTP_OPCODE_SIZE

#define TFTP_OPCODE_SIZE 2

TFTP_PACKET_SIZE

#define TFTP_PACKET_SIZE (TFTP_OPCODE_SIZE + 2)

2.9.4.35.6 Variable Documentation

current_block

uint16_t current_block = 0x0000[static]

last_block

volatile bool last_block = false

next_block

uint16_t next_block = 0x0000[static]

prev_block

uint16_t prev_block = 0x0000[static]

tftp_last_address

uint32_t tftp_last_address = 0x00020000

tftp_modes

const char* tftp_modes[] = {"netascii", "octet", "mail"}

tftp_msg

tftp_t tftp_msg

tftp_option

const char tftp_option[] = "blksize"

2.9.4.36 source/tftp.h File Reference

#include <stdbool.h>

2.9.4.36.1 Data structures

2.9.4.36.2 Functions

  • void TFTP_Ack (uint8_t opcode)

    Sends an acknowledgement on receiving a packet from a TFTP Server.

  • error_msg TFTP_Read_Write_Request (uint8_t opcode)

    Sends a read or write request to the TFTP server depending on the opcode.

  • void TFTP_Handler (int16_t length)

    Processes a TFTP message as per the opcode in the packet.

  • void Process_TFTP_Data (uint32_t address, char *data, uint16_t length)

    Processes TFTP packets with 'data' opcode and blocks of the specified size. Depending on TFTP_callBackTable, the storage can be in EEPROM, Flash, etc.

  • void TFTP_Configure (uint32_t tftp_server_address, char *tftp_filename, char *tftp_block_size)

    Allows the user to configure the TFTP server options.

2.9.4.36.6 Detailed Description

TFTP Client Protocol Header File

2.9.4.36.7 Macro Definition Documentation

DESTPORT_TFTP

#define DESTPORT_TFTP 69

2.9.4.36.8 Variable Documentation

last_block

volatile bool last_block

tftp_last_address

uint32_t tftp_last_address

tftp_msg

tftp_t tftp_msg

2.9.4.37 source/tftp_handler_table.h File Reference

This file contains the TFTP application callback table.

#include <stdint.h>

2.9.4.37.5 Detailed Description

This file contains the TFTP application callback table.

TFTP Port Handler Header File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.37.6 Macro Definition Documentation

DEFAULT

#define DEFAULT 0

EEPROM

#define EEPROM 1

EXTERNAL_STORAGE

#define EXTERNAL_STORAGE 2

tableSize

#define tableSize (sizeof(TFTP_callBackTable)/sizeof(*TFTP_callBackTable))

2.9.4.37.7 Typedef Documentation

TFTP_receive_function_ptr

typedef uint8_t(* TFTP_receive_function_ptr) (uint32_t, char *, uint16_t)

2.9.4.37.8 Variable Documentation

TFTP_callBackTable

const store_handler_t TFTP_callBackTable[]

Initial value:

= 
{
}

2.9.4.38 source/udpv4.c File Reference

This file provides the API implementation for the User Datagram Protocol version 4 (UDP v4).

#include <stdio.h>
#include <stdbool.h>
#include <stddef.h>
#include "../ipv4.h"
#include "../udpv4.h"
#include "../udpv4_port_handler_table.h"
#include "../network.h"
#include "../../ethernet/physical_layer_interface.h"
#include "../tcpip_types.h"
#include "../icmp.h"

2.9.4.38.1 Functions

2.9.4.38.3 Detailed Description

This file provides the API implementation for the User Datagram Protocol version 4 (UDP v4).

UDP Protocol v4 Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.38.4 Variable Documentation

destPort

uint16_t destPort

udpHeader

udpHeader_t udpHeader

2.9.4.39 source/udpv4.h File Reference

#include <stdbool.h>
#include "tcpip_types.h"
#include "../ethernet/physical_layer_interface.h"

2.9.4.39.1 Functions

2.9.4.39.2 Macros

2.9.4.39.4 Detailed Description

UDP v4 Protocol Header File

2.9.4.39.5 Macro Definition Documentation

UDP_DataLength

#define UDP_DataLength( ) ((udpHeader.length) - 8)

UDP_FlushRxdPacket

#define UDP_FlushRxdPacket( ) ETH_Flush()

UDP_FlushTXPackets

#define UDP_FlushTXPackets( ) ETH_TxReset()

UDP_GetDestIP

#define UDP_GetDestIP( ) (ipv4Header.srcIpAddress)

UDP_GetDestPort

#define UDP_GetDestPort( ) (destPort)

UDP_GetSrcIP

#define UDP_GetSrcIP( ) (ipv4Header.dstIpAddress)

UDP_GetSrcPort

#define UDP_GetSrcPort( ) (udpHeader.dstPort)

UDP_Read16

#define UDP_Read16( ) ETH_Read16()

UDP_Read24

#define UDP_Read24( ) ETH_Read24()

UDP_Read32

#define UDP_Read32( ) ETH_Read32()

UDP_Read8

#define UDP_Read8( ) ETH_Read8()

UDP_ReadBlock

#define UDP_ReadBlock( data, length) ETH_ReadBlock(data,length)

UDP_Write16

#define UDP_Write16( data) ETH_Write16(data)

UDP_Write24

#define UDP_Write24( data) ETH_Write24(data)

UDP_Write32

#define UDP_Write32( data) ETH_Write32(data)

UDP_Write8

#define UDP_Write8( data) ETH_Write8(data)

UDP_WriteBlock

#define UDP_WriteBlock( data, length) ETH_WriteBlock(data,length)

UDP_WriteString

#define UDP_WriteString( data) ETH_WriteString(data)

2.9.4.39.6 Variable Documentation

destPort

uint16_t destPort

ipv4Header

ipv4Header_t ipv4Header

udpHeader

udpHeader_t udpHeader

2.9.4.40 source/udpv4_port_handler_table.c File Reference

This file provides the API implementation for the UDP v4 protocol.

#include <stdio.h>
#include "../tcpip_config.h"
#include "../dns_client.h"
#include "../dhcp_client.h"
#include "../ntp.h"
#include "../udpv4_port_handler_table.h"
#include "../tftp.h"

2.9.4.40.3 Detailed Description

This file provides the API implementation for the UDP v4 protocol.

UDP Port Handler Source File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.41 source/udpv4_port_handler_table.h File Reference

This file contains the UDP callback table.

#include "tcpip_types.h"

2.9.4.41.1 Data structures

2.9.4.41.4 Detailed Description

This file contains the UDP callback table.

UDP Port Handler Header File

Version: TCP/IP Lite Driver Version 5.0.0

2.9.4.41.5 Variable Documentation

udp_table_iterator_t

const typedef udp_handler_t* udp_table_iterator_t