www.beck-ipc.com

@CHIP-RTOS - Data Structures used in TCP/IP API


    IPC@CHIP® Documentation Index

Data Structures

Here are the BSD structures and other data types used by the TCP/IP API.
All constants and data structures are defined in the TCPIPAPI.H header file.

Notes:
  1. Byte alignment is required within all data structures used within the API.
  2. The phrase "network byte order" means big endian (like Motorola machines, unlike Intel).

Related : Contents :

  • ArpHeader
  • ArpRouteCacheEntry
  • ArpUserCallbackInfo
  • atEntry
  • DnsMailHost
  • fd_set
  • GetSocketOption
  • IcmpMib
  • Iface_Entry
  • Iface_Entry_Ext
  • IfaceIPv6_Entry
  • IfMib
  • in_addr
  • in6_addr
  • IpMib
  • IpUserCallbackInfo
  • Packet_Count
  • PasCallBack
  • Ping
  • PKI_CERT_ADD_Entry
  • PKI_OWNKEYPAIR_ADD_Entry
  • PPPClie_ModemCmd
  • PPPClie_ModemCtrl
  • PPPClient_Init
  • PPPClient_Init_IPv6
  • PPPDial
  • PPP_IPCfg_Data
  • PPP_IPCfg_Data_IPv6
  • PPP_ModemHangup
  • PPP_Option
  • recv_params
  • Route_Entry
  • send_params
  • SetSocketOption
  • sockaddr
  • sockaddr_in
  • sockaddr_in6
  • sockaddr_storage
  • SocketInfo
  • SocketInfoIpv4v6
  • SSL_SESSION_NEW_Entry
  • TcpMib
  • timeval
  • UdpMib
  • UserEthDhcp_Entry


  • ArpHeader


    Address Resolution Protocol (ARP) packet header has following form.

                
    typedef struct tag_ArpHeader
    {
        unsigned int     arpHardware;
        unsigned int     arpProtocol;
        unsigned char    arpHardwareLength;
        unsigned char    arpProtocolLength;
        unsigned int     arpOperation;
        unsigned char    arpSendPhyAddress[6];
        unsigned char    arpSendNetAddress[4];
        unsigned char    arpTargetPhyAddress[6];
        unsigned char    arpTargetNetAddress[4];
    } ArpHeader;

    Related Topics

    Register_ARP_User_CB() API - Install ARP callback function

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.10V1.00V1.00V0.90V1.00

    Top of list
    Index page

    ArpRouteCacheEntry


                
    typedef struct tagArpRouteCacheEntry
    {
        unsigned int   ifIndex;       // Interface index for this entry
        unsigned long  flags;         // Type/state of entry (see below)
        unsigned long  arpIpAddress;  // Device IP address or network address
        unsigned long  mask;          // Ip network mask for cloned ARP entries
        long           arpTtl;        // TimeToLive in milliseconds
        long           hops;          // Number of routers between this host and route
    
        union
        {
            struct
            {
                // Device IP address for Local routing entry
                unsigned long  DevIpAddress;
            } LocalNetRouteEntry;
            struct
            {
                // Device Ethernet address for ARP entry
                unsigned char MacAddress[6];
                unsigned char filler[2];
            } ArpEntry;
            struct
            {
                unsigned long  GatewayIpAddress;   // Indirect route
            } GatewayEntry;
        } ArpRouteGwayUnion;
    } ArpRouteCacheEntry;

    Comments

    flags
      This bit field is defined as follows:

      Note: Bit 2, 3, and 4 select the view of the ArpRouteGwayUnion union.
      Bit 2:   Indirect route (GatewayEntry structure)
      Bit 3:   Valid ARP entry (ArpEntry structure)
      Bit 4:   Local route (LocalNetRouteEntry structure)
      Bit 5:   Static route
      Bit 10, 11:   Cloned ARP entry (e.g. ARP entry for default gateway)
      Bit 16:   Route is up
      Bit 17:   arpIpAddress entry is a host address, 0: network address

    Related Topics

    GetARPRouteCacheEntries() API - Read internal ARP/Route cache table

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.10V1.00V1.00V0.90V1.00

    Top of list
    Index page

    ArpUserCallbackInfo


    A structure of this type is passed as an input parameter to an ARP user callback handler.

                
    typedef struct ArpUserCallbackInfo
    {
       int              size;         // Size of this structure
       unsigned int     dataLength;   // Length of the data in the ARP package
       void    far *    dataPtr;      // Pointer to the ARP data
       void    far *    devHandlePtr; // Device handle pointer of this incoming packet
                                      // for detecting the source device
    } ArpCallbackUserInfo_t;

    Related Topics

    ArpHeader data structure
    Register_ARP_User_CB() API - Install ARP callback function

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.22V1.22V1.22V1.11V1.00

    Top of list
    Index page

    atEntry


                
    typedef struct tagAtEntry {
        long           IfIndex;         // Interface on which this entry maps
        unsigned char  PhysAddress[11]; // Physical address of destination
        unsigned char  PhysAddressLen;  // Length of PhysAddress
        unsigned long  NetAddress;      // IP address of physical address
    } atEntry;

    SC1x Comments

    These structures are only available in SC1x @CHIP-RTOS versions which contain the SNMP option.   A SNMP agent is not part of the @CHIP-RTOS.   But if a user is able to implement an agent based on the TCP/IP API, they need access to the internal TCP/IP SNMP variables.

    Related Topics

    Get_SNMP_Data() API - Get internal TCP/IP SNMP variables

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.01V1.00V1.00V0.90V1.00

    Top of list
    Index page

    DnsMailHost


    Holds information on a mail host.

                
    typedef struct DnsMailHost_
    {
      char name[DNS_SIZE_NAME_STRING + 1];  // Domain name of the host
      unsigned short preference;            // Preference value of the host. Lower values are preferred.
    } DnsMailHost;

    Related Topics

    getMailHosts() API

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      n/an/an/aV1.05V1.00

    Top of list
    Index page

    fd_set


                
    typedef unsigned int fd_mask ;
    
    typedef struct fd_set
    {
        fd_mask fds_bits[MAX_BECK_SOCKETS/16] ;    // Socket bit field
    } fd_set;

    Comments

    This data structure provides a bit field to specify which sockets to monitor and which sockets events occur in the select() API.   Each bit corresponds to a socket.   The socket descriptor is used to provide the mapping between bits and sockets.   For example for a socket with descriptor zero, this socket will be represented by bit 0 in this field.

    A set of macros are provided in the Beck C-library TCPIPAPI.H header file for manipulating these bit fields:

      FD_SET(n, p) - Sets bit 'n' in fd_set at pointer 'p' to 1.

      FD_CLR(n, p) - Zeroes bit 'n' in fd_set at pointer 'p'.

      FD_ISSET(n, p) - Tests bit 'n' in fd_set at pointer 'p'.

      FD_ZERO(p) - Clears all bits in fd_set at pointer 'p'.

      FD_COPY(src, dest) - Copies object at pointer 'src' into the object at pointer 'dest'.   The intent here is that both of these pointers reference a fd_set structure, but the compiler will not type check this for you.


    Also the socket iterator function FD_Next() is available to sequence through a set of sockets.

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.22V1.22V1.22V1.11V1.00

    Top of list
    Index page

    GetSocketOption


    This data structure and specified constants are defined in the TCPIPAPI.H library header file.

                
    typedef struct tag_getsockopt
    {
        int         protocol_level;   // Protocol level: IP level, TCP level or socket level
        int         optionName;       // Option's name
        char  far  *optionValue;      // Pointer to the option value buffer (type varies)
        int   far  *optionLength;     // Length of option value buffer
    
    } GetSocketOption;

    Comments

    The type of data found at the location referenced by the optionValue member pointer varies depending on the particular socket option that is being dealt with.

    When manipulating socket options, the protocol_level at which the option resides and the name of the option (optionName member) must be specified.   The size of the buffer (in bytes) pointed to by the optionValue member depends on the option, and this size must be specified in the optionLength field.      These sizes are stated in the list of options below.   The API uses the optionValue and optionLength members to report option values.

    The following list specifies the three different protocol levels and their valid socket options, including a short description and the length of the option value.   Protocol level and optionName constants referred to here are defined in TCPIPAPI.H header file.

    Important : The constants for IPC@CHIP® SC1x and SC1x3/SC2x are different.   Take a look at the respective target sections in TCPIPAPI.H. Use always the defined constant names.

    protocol_level=IP_PROTOIP_LEVEL     (IP level options)

    • optionName=IPO_TOS:         Size: 8 bit, sizeof(char)
          Set IP type of service.
          default: 0

    • optionName=IPO_TTL:         Size: 8 bit, sizeof(char)
          Set IP time-to-live router hops.
          default: 64

    protocol_level=IP_PROTOTCP_LEVEL     (TCP level options)

    • optionName=TCP_NODELAY:     Size: 16 bit, sizeof(int)
          1: Disable nagle algorithm / 0: Enable nagle algorithm
          default: 0

    • optionName=TCP_NOPUSH:      Size: 16 bit, sizeof(int)
          1: Force TCP to delay sending any TCP data until a full sized segment is buffered in the TCP buffers
          (useful if continuous large amount of data is sent as with FTP).
          default: 0

    • optionName=TCP_SLOW_START:  Size: 16 bit, sizeof(int)
          1: Enable the TCP slow start algorithm / 0: disable
          default: 1

    • optionName=TCP_KEEPALIVE:   Size: 16 bit, sizeof(int)
          Set idle time seconds before sending keep alive probes.
          default: 7200, minimum: 10, maximum: 32767 seconds
          Notes:
      1. The socket level option SO_KEEPALIVE (see below) must be enabled.
      2. The minimum value was changed in @CHIP-RTOS V0.70 to 10 seconds (was 7200 seconds in @CHIP-RTOS V0.69).

    • optionName=TCP_DELAY_ACK:   Size: 16 bit, sizeof(int)
          Set the TCP delay ACK time in milliseconds.
          default: 200, minimum: 0, maximum: 65535 ms

    • optionName=TCP_FINWT2TIME:  Size: 16 bit, sizeof(int)
          Set the maximum amount of time TCP will wait for the remote side to close.
          default: 600, minimum: 0, maximum: 32767 seconds

    • optionName=TCP_2MSLTIME:    Size: 16 bit, sizeof(int)
          Set the maximum amount of time TCP will wait in the TIME WAIT state, once it has initiated a close.
          default: 2, minimum 0, maximum 32767 seconds

    • optionName=TCP_MAXRT:       Size: 16 bit, sizeof(int)
          Set the TCP/IP timeout in seconds, (0=System Default [75 Seconds], -1 = endless).
          default: 75, minimum: 1, maximum: 32767 seconds or endless.

    • optionName=TCP_MAXREXMIT:   Size: 16 bit, sizeof(int)
          Set the maximum number of TCP/IP send retries.
          default 12, minimum 0, maximum 32767

    • optionName=TCP_KEEPALIVE_INTV: Size: 16 bit, sizeof(int)
          Set keep alive interval probes.
          default: 75, minimum: 1, maximum: 600 seconds
          Notes:
      1. This value can not be changed after a connection is established.
      2. Also the socket must not be in listen mode.

    • optionName=TCP_KEEPALIVE_CNT: Size: 16 bit, sizeof(int)
          Set maximum number of keep alive probes before TCP gives up and closes the connection.
          default: 8, minimum: 0, maximum: 32767

    • optionName=TCP_SSL_CLIENT:  Size: 16 bit, sizeof(int)
          Enable SSL client negotiation, 1: enable, 0: disable
          default: 0

    • optionName=TCP_SSL_SERVER:  Size: 16 bit, sizeof(int)
          Enable SSL server negotiation, if set for a listening socket, all accepted sockets inherit this option value, 1: enable, 0: disable
          default: 0

    • optionName=TCP_SSLSESSION:  Size: 16 bit, sizeof(int)
          Set session Id for socket, if set for a listening socket, all accepted sockets inherit this option value

    • optionName=TCP_SSL_SEND_MIN_SIZE: Size: 16 bit, sizeof(int)
          Set the SSL send minimum size, if users send data is less than this value, user data will be queued.
          default: 0 (no queue), minimum 0, maximum 65535

    • optionName=TCP_SSL_SEND_MAX_SIZE: Size: 16 bit, sizeof(int)
          Set the SSL record maximum size, each record will at most have that much user data encapsulated.
          User data bigger than that size limit will be cut into two records.
          default: 8000 (no queue), minimum 100, maximum 16384

    • optionName=TCP_RTO_DEF:     Size: 32 bit, sizeof(long)
          Set the default retransmission timeout value in milliseconds.
          default: 3000 ms.

    • optionName=TCP_RTO_MIN:     Size: 32 bit, sizeof(long)
          Set the minimum retransmission timeout value in milliseconds.
          default: 100 ms.

    • optionName=TCP_RTO_MAX:     Size: 32 bit, sizeof(long)
          Set the maximum retransmission timeout value in milliseconds.
          default: 64000 ms.

    • optionName=TCP_TS:          Size: 16 bit, sizeof(int)
          Turn on/off the TCP time stamp option. 1: Enable TCP time stamp, 0: disable
          default: 1
          Notes:
      1. This value can not be changed after a connection is established.
      2. Also the socket must not be in listen mode.

    protocol_level=SOCKET_LEVEL

    • optionName=SO_REUSEADDR:    Size: 16 bit, sizeof(int)
          Enable/disable local address reuse, 1: enable, 0: disable
          default: 1

    • optionName=SO_KEEPALIVE:    Size: 16 bit, sizeof(int)
          Keep connections alive, 1: enable, 0: disable
          default: 0

    • optionName=SO_SNDBUF:       Size: 32 bits, sizeof(long)
          Socket send buffer size.   We recommend a maximum size of 8192 Bytes.
          default: TCP 4096, UDP 2048 bytes.

    • optionName=SO_RCVBUF:       Size: 32 bits, sizeof(long)
          Socket input buffer size.   We recommend a maximum size of 8192 Bytes.
          default: TCP 4096, UDP 2048 bytes.

    Related Topics

    getsockopt() API - Get socket options
    SetSocketOption structure typedef

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.01V1.00V1.00V0.90V1.00

    Top of list
    Index page

    IcmpMib


                
    typedef struct tagIcmpMib
    {
       unsigned long       icmpInMsgs;          // Total of ICMP msgs received
       unsigned long       icmpInErrors;        // Total of ICMP msgs received with errors
       unsigned long       icmpInDestUnreachs;
       unsigned long       icmpInTimeExcds;
       unsigned long       icmpInParmProbs;
       unsigned long       icmpInSrcQuenchs;
       unsigned long       icmpInRedirects;
       unsigned long       icmpInEchos;
       unsigned long       icmpInEchoReps;
       unsigned long       icmpInTimestamps;
       unsigned long       icmpInTimestampReps;
       unsigned long       icmpInAddrMasks;
       unsigned long       icmpInAddrMaskReps;
       unsigned long       icmpOutMsgs;
       unsigned long       icmpOutErrors;
       unsigned long       icmpOutDestUnreachs;
       unsigned long       icmpOutTimeExcds;
       unsigned long       icmpOutParmProbs;
       unsigned long       icmpOutSrcQuenchs;
       unsigned long       icmpOutRedirects;
       unsigned long       icmpOutEchos;
       unsigned long       icmpOutEchoReps;
       unsigned long       icmpOutTimestamps;
       unsigned long       icmpOutTimestampReps;
       unsigned long       icmpOutAddrMasks;
       unsigned long       icmpOutAddrMaskReps;
    } IcmpMib;

    SC1x Comments

    These structures are only available in SC1x @CHIP-RTOS versions which contain the SNMP option.   A SNMP agent is not part of the @CHIP-RTOS.   But if a user is able to implement an agent based on the TCP/IP API, they will need access to these internal TCP/IP variables.

    Related Topics

    Get_SNMP_Data() API - Get internal TCP/IP SNMP variables

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.01V1.00V1.00V0.90V1.00

    Top of list
    Index page

    Iface_Entry


                
    typedef struct tag_iface_device
    {
         unsigned int  devIndex;       // Internal index number
         char          devName[14];    // Device name, terminated by zero
         unsigned long devIPAddr;      // IP address for this interface
         unsigned long devNetmask;     // Netmask for the route
         unsigned long devDestIpAddr;  // Remote peer address for PPP
         unsigned char PhysAddr[6];    // Physical device address, max. 6 Bytes
         int           devType;        // Type of the device driver:
                                       // 0: unknown,
                                       // 1: Ethernet driver,
                                       // 2: PPP protocol
                                       // 4: SLIP protocol (not supported)
                                       // 5: Internal loopback
         int           devDHCP;        // Interface configured by DHCP? 1:0
         int           devFlag;        // Device status flag
                                       // Bit1 == 1  Device opened
                                       // Bit2 == 1  Device IP config in progress(PPP or DHCP)
                                       // Bit3 == 1  Device open completed
         int           devMTU;         // Max. Transfer Unit
         void far *    reserved;
    } Iface_Entry;

    Related Topics

    Get_Iface_Entries() API - Read table of TCP/IP device interfaces

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.01V1.00V1.00V0.90V1.00

    Top of list
    Index page

    Iface_Entry_Ext


    SC1x:

                
    typedef struct tag_iface_device_ext
    {
       unsigned int  devIndex;        //Internal index number
       char          devName[14];     //Device name
       unsigned long devIPAddr[4];    //IP addresses for this interface
       unsigned long devNetmask[4];   //Netmasks for the route
       unsigned long devDestIpAddr[4];//Remote peer addresses for PPP
       unsigned char PhysAddr[6];     //Physical device address, max. 6 Bytes
    
       int  devType;                  // type of the device driver:
                                      // 0: unknown,
                                      // 1: ethernet driver,
                                      // 2: use PPP protocol   server
                                      // 3: use PPP protocol client
                                      // 4: Internal loopback
       int  devDHCP[4];               // Interface configured by DHCP 1:0
       int  devFlag;
       int  devMTU;                   // Max. Transfer Unit
       void far *    IfaceHandle;     // handle type, to identify the interface internal
    }Iface_Entry_Ext;

    SC1x3/SC2x:

                
    typedef struct tag_iface_device_ext
    {
      unsigned int  devIndex;        // Internal index number
      char          devName[14];     // Device name
      unsigned long devIPAddr[5];    // IP addresses for this interface
      unsigned long devNetmask[5];   // Netmasks for the route
      unsigned long devDestIpAddr[5];// Remote peer addresses for PPP
      unsigned char PhysAddr[6];     // Physical device address, max. 6 Bytes
    
      int  devType;                  // type of the device driver:
                                     // 0: unknown,
                                     // 1: ethernet driver,
                                     // 2: use PPP protocol   server
                                     // 3: use PPP protocol client
                                     // 4: Internal loopback
       int  devDHCP[5];              // Interface configured by DHCP 1:0
       int  devFlag;
       int  devMTU;                  // Max. Transfer Unit
       void far *    IfaceHandle;    // handle type, to identify the interface internal
    }Iface_Entry_Ext;

    Related Topics

    Get_Iface_Entries_Ext() API - Read table of TCP/IP device interfaces

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.20V1.20V1.20V1.05V1.00

    Top of list
    Index page

    IfaceIPv6_Entry


                
    typedef struct tag_user_iface_ipv6_entry{
        void  far *     devIfaceHandle;       // Device handle pointer (internal used)
        int             devIndex;             // Internal used index number
        int             devType;              // Type of the device driver:
                                              // 0: unknown,
                                              // 1: Ethernet driver,
                                              // 2: PPP protocol
                                              // 4: SLIP protocol (not supported)
                                              // 5: Internal loopback
        char            devName[14];          // Device name, terminated by zero
        unsigned int    devFlags;             // Device status flag
        unsigned int    devIPv6Flags;         // IPv6 status flags
        unsigned int    devIPv6Mtu;           // The MTU of the IPv6 link
        struct in6_addr devIPv6PPPPeerIpAddr; // Remote peer address for PPP
        struct in6_addr devIPv6AddrArray[10];
        unsigned char   devIPv6PrefixLen[10];
        unsigned char   devIPv6AddrFlagsArray[10]; // Array of configuration flags
        unsigned char   devPhysAddr[6];       // Physical address of the interface
        void far      * devIPv6ExtensionPtr; //for future use
    }IfaceIPv6_Entry;

    Comments

    Further explanations for certain structure members follows.

    devFlags
      Device status flags:

        Bit1 == 1   Device opened
        Bit2 == 1   Device IPv6 config in progress
        Bit3 == 1   Device open completed

    devIPv6Flags
      IPv6 status flags:

        Bit1 == 1   Link-layer address configured
        Bit2 == 1   Link-local address configured (or is pending)
        Bit3 == 1   Site-local address configured (or is pending)
        Bit4 == 1   Global scope IPv6 native address
        Bit5 == 1   Global scope IPv4-compatible IPv6 address configured
        Bit6 == 1   Global scope 6-to-4 IPv6 address
        Bit7 == 1   IPv6 connectivity established on PPP interface

    devIPv6AddrArray
      Array of all configured IPv6 addresses on this interface.

    devIPv6PrefixLen
      Array of all configured Prefix length of all IPv6 addresses.

    Related Topics

    Get_IPv6_Iface_Entries() API - Read table of TCP/IPv6 device interfaces

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      n/an/an/aV0.90V1.00

    Top of list
    Index page

    IfMib


                
    typedef struct tagIfMib           // Interface table data
    {
        long          ifIndex;        // index of this interface
        char          ifDescr[32];    // description of interface
        long          ifType;         // network device type
        long          ifMtu;          // maximum transfer unit
        unsigned long ifSpeed;        // bandwidth in bits/sec
        unsigned char ifPhysAddress[11];  // interface's address
        unsigned char PhysAddrLen;    // length of physAddr: 6
        long          ifAdminStatus;  // desired state of interface, not supported
        long          ifOperStatus;   // current operational status, not supported
        //counters
        unsigned long   devLastChange;      // value of sysUpTime when current state entered
        unsigned long   devInOctets;        // number of octets received on interface
        unsigned long   devInUcastPkts;     // number of unicast packets delivered
        unsigned long   devInMulticastPkts; // number of multicast packets delivered,
                                            //   not supported.
        unsigned long   devInBroadcastPkts; // broadcasts delivered
        unsigned long   devInDiscards;      // number of broadcasts
        unsigned long   devInErrors;        // number of packets containing errors
        unsigned long   devInUnknownProtos; // number of packets with unknown protocol
        unsigned long   devOutOctets;       // number of octets transmitted
        unsigned long   devOutUcastPkts;    // number of unicast packets sent
        unsigned long   devOutMulticastPkts;// number of multicast packets sent
        unsigned long   devOutBroadcastPkts;// broadcasts sent
        unsigned long   devOutDiscards;     // number of packets discarded with no error
        unsigned long   devOutErrors;       // number of pkts discarded with an error
        unsigned long   devOutQLen;         // number of packets in output queue
        unsigned long   devSpecific;
    } IfMib;

    SC1x Comments

    These structures are only available in SC1x @CHIP-RTOS versions which contain the SNMP option.   A SNMP agent is not part of the @CHIP-RTOS.   But if a user is able to implement an agent based on the TCP/IP API, they need access to the internal TCP/IP SNMP variables.   The SNMP MIB variables are not a part of our current official 6 @CHIP-RTOS versions.   It's necessary to order directly a @CHIP-RTOS version which includes this feature.

    Related Topics

    Get_SNMP_Data() API - Get internal TCP/IP SNMP variables

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.01V1.00V1.00V0.90V1.00

    Top of list
    Index page

    in_addr


                
    struct in_addr
    {
        u_long s_addr; // 32 bit netid/hostid address in network byte order
    };

    Related Topics

    sockaddr_in data structure

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page

    in6_addr


    128-bit IPv6-formatted address in network byte order

                
    struct in6_addr
    {
        union
        {
            unsigned char  ip6U8[16];
            unsigned short ip6U16[8];
            unsigned long  ip6U32[4];
        } ip6Addr;
    };

    Comments

    Mapped IPv4 addresses will appear in the ip6Addr.ip6U32[3] member.

    Related Topics

    See sockaddr_in6 structure

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      n/an/an/aV0.90V1.00

    Top of list
    Index page

    IpMib


                
    typedef struct tagIpMib
    {
        long                ipForwarding;      // 1
        long                ipDefaultTTL;      // default TTL for pkts originating here
        unsigned long       ipInReceives;      // no. of IP packets received from interfaces
        unsigned long       ipInHdrErrors;     // number of pkts discarded due to header errors
        unsigned long       ipInAddrErrors;    // no. of pkts discarded due to bad address
        unsigned long       ipForwDatagrams;   // number pf pkts forwarded through this entity
        unsigned long       ipInUnknownProtos; // no. of local-addressed pkts w/unknown proto
        unsigned long       ipInDiscards;      // number of error-free packets discarded
        unsigned long       ipInDelivers;      // number of datagrams delivered to upper level
        unsigned long       ipOutRequests;     // number of IP datagrams originating locally
        unsigned long       ipOutDiscards;     // number of error-free output IP pkts discarded
        unsigned long       ipOutNoRoutes;     // number of IP pkts discarded due to no route
        long                ipReasmTimeout;    // seconds fragment is held awaiting reassembly
        unsigned long       ipReasmReqds;      // no. of fragments needing reassembly (here)
        unsigned long       ipReasmOKs;        // number of fragments reassembled
        unsigned long       ipReasmFails;      // number of failures in IP reassembly
        unsigned long       ipFragOKs;         // number of datagrams fragmented here
        unsigned long       ipFragFails;       // no. pkts unable to be fragmented here
        unsigned long       ipFragCreates;     // number of IP fragments created here
        unsigned long       ipRoutingDiscards;
    } IpMib;

    SC1x Comments

    These structures are only available in SC1x @CHIP-RTOS versions which contain the SNMP option.   A SNMP agent is not part of the @CHIP-RTOS.   But if a user is able to implement an agent based on the TCP/IP API, they need access to these internal TCP/IP variables.

    Related Topics

    Get_SNMP_Data() API - Get internal TCP/IP SNMP variables

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.01V1.00V1.00V0.90V1.00

    Top of list
    Index page

    IpUserCallbackInfo


    A structure of this type is passed as an input parameter to an IP user callback handler.

                
    struct IpUserCallbackInfo
    {
       int              size;        // Size of this struct
       unsigned long    srcAddr;     // Source IP Address (in long format, already in correct byte order)
       unsigned long    destAddr;    // Destination IP Address (in long format, already in correct byte order)
       unsigned int     srcPort;     // Source Port (already in correct byte order)
       unsigned int     destPort;    // Destination Port (already in correct byte order)
       unsigned char    protocol;    // Protocol (see list below)
       int              fragmented;  // 0: it is an unfragmented package, 1: it is a fragment
       unsigned int     dataLength;  // Length of the data in the IP package
                                     //  (only available if package is not fragmented!)
       void far *       dataPtr;     // Pointer to the IP data
                                     //  (only available if package is not fragmented!)
       //Extended: Since SC12 RTOS 1.11 B, SC13 1.01B
       // Use the size parameter of this struct at your application, for detecting,
       // if these struct members are available
       void *           ipHdrPtr;    // Pointer to the IP header
       unsigned int     ipHdrLen;    // length of IP header
    } IpCallbackUserInfo;

    Comments

    Protocol types enumerated by the protocol member are coded as follows:

      1     ICMP    (Internet Control Management Protocol )
      2     IGMP    (Internet Group Management Protocol )
      6     TCP    (Transmission Control Protocol )
      17    UDP    (User Datagram Protocol )

    Note:   The IP callback function will be called before defragmenting fragmented IP packages.   So if we receive a fragmented package, the IP callback will be called for every received fragment.

    SC1x3/SC2x Comments

    At the current SC1x3/SC2x CHIP-RTOS version the IP callback features exists only for IPv4 packets.

    Related Topics

    RegisterIPCallbackHandler() API - Install IP callback function

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.10V1.00V1.00V0.90V1.00

    Top of list
    Index page

    Packet_Count


                
    typedef struct tag_cnt_packet
    {
        unsigned int far * cnt_all_packets;      // count all incoming Ethernet packets
        unsigned int far * cnt_ip_packets;       // count incoming IP packets
        unsigned int far * cnt_arp_packets;      // count incoming ARP packets
        unsigned int far * cnt_tcp_packets;      // count incoming TCP packets
        unsigned int far * cnt_udp_packets;      // count incoming UDP packets
        unsigned int far * cnt_icmp_packets;     // count incoming ICMP packets
    
        unsigned int far * cnt_all_sended_packets;  // count all sent Ethernet packets
        unsigned int far * cnt_ip_sended_packets;   // count all sent IP packets
        unsigned int far * cnt_arp_sended_packets;  // count all sent ARP packets
        unsigned int far * cnt_tcp_sended_packets;  // count all sent TCP packets
        unsigned int far * cnt_udp_sended_packets;  // count all sent UDP packets
        unsigned int far * cnt_icmp_sended_packets; // count all sent ICMP packets
    
        unsigned int far * cnt_ip_chksum_errs;   // checksum errors on incoming IP packets
        unsigned int far * cnt_udp_chksum_errs;  // checksum errors on incoming UDP packets
        unsigned int far * cnt_tcp_chksum_errs;  // checksum errors on incoming TCP packets
        unsigned int far * cnt_eth_errs;         // errors on incoming Ethernet packets
    
    } Packet_Count;

    Comments

    The counters count_all_packets and count_all_sended_packets count only Ethernet packets.
    Other counters also count the packets from and to other devices e.g. local loopback packets and PPP packets.

    Related Topics

    Get_TCPIP_Statistics() API - Access packet counts.

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page

    PasCallBack


                
    typedef struct tag_PasCallBack
    {
        int         sd;     // socket descriptor
        int         event;  // occurred event
    } PasCallBack;

    Comments

    The pointer to this structure will be passed to a Pascal callback function in the registers ES:DI.   You can read out the information about the socket and the event which has triggered the callback function.

    Related Topics

    To register a Pascal callback function see API_REGISTER_CALLBACK_PASCAL

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.02V1.00V1.00n/an/a

    Top of list
    Index page

    Ping


                
    typedef struct tag_ping_command
    {
       int     sd;                 // Socket descriptor, set by PING_OPEN
       // User must set following four values prior to Ping_Open() API call
       char far *remoteHostNamePtr; // Remote IP
       int     pingInterval;       // seconds
       int     pingDataLength;     // Maximum 2080 bytes
       unsigned long count;        // Limit number of pings sent.  Set to
                                   //  zero if ping should run forever
                                   //  (until Ping_Close() is called).
    
       unsigned char pingstate;    // ping socket state, 1: open 0: closed
       // Statistics, filled in by system inside Ping_Statistics() API:
       unsigned long transmitted;  // Sent ping requests count
       unsigned long received;     // Received replies count
       unsigned int lastsenderr;   // Last send error
       unsigned int lastrcverr;    // Last receive error
       unsigned long maxRtt;       // Maximum round trip time (ms)
       unsigned long minRtt;       // Minimum round trip time (ms)
       unsigned long lastRtt;      // Round trip time (ms) of
                                   //  the last ping request/reply.
    
    } Ping;

    Comments

    Caller to Ping_Open() API must initialize structure members:

      remoteHostNamePtr ... who to "ping"
      pingInterval ... block repetition rate in seconds
      pingDataLength ... size of ping data blocks
      count ... set to zero, if ping should run forever

    The remainder of the data structure is managed within the API functions.

    Related Topics

    API function Ping_Open() - Start ICMP echo requests
    API function Ping_Statistics() - Collect results

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.21V1.21V1.21V1.10V1.00

    Top of list
    Index page

    PKI_CERT_ADD_Entry


                
    typedef struct tag_pki_cert_add_entry
    {
      void far * fileNamePtr; // file name of certificate
      int        fileFormat;  // file format:      0x01 = PEM format,
                              //                   0x02 = DER format
      int        certType;    // certificate type: Bit0 = 1: local certificate,
                              //                   Bit1 = 1: non local certificate (CA or peer),
                              //                   Bit3 = 1: root CA certificate (use together with Bit1)
      void far * idPtr;       // identification string
      int        idLength;    // length of identification string
      void far * caIdPtr;     // CA identication string
    } PKI_CERT_ADD_Entry;

    Comments

    If caIdPtr is NULL then the PKI will automatically search the existing certificate database to find the CA by matching DN (distinguished name). If the root CA is added caIdPtr should be NULL.

    Related Topics

    PKI_CertificateAdd() API - Add certificate to public key infrastructure

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      n/an/an/aV0.91V1.00

    Top of list
    Index page

    PKI_OWNKEYPAIR_ADD_Entry


                
    typedef struct tag_pki_ownkeypair_add_entry
    {
      void far * fileNamePtr; // file name of public/private key file
      int        fileFormat;  // file format: 0x01 = PEM format,
                              //              0x02 = DER format
      int        keyType;     // key type:    0x00 = RSA key
    } PKI_OWNKEYPAIR_ADD_Entry;

    Related Topics

    PKI_OwnKeyPairAdd() API - Add a public/private key pair

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      n/an/an/aV0.91V1.00

    Top of list
    Index page

    PPPClie_ModemCmd


                
    typedef struct tag_pppclie_modem_cmd
    {
          char  * modemcmd;    //modem command string (e.g. +++ or ATO);
          char  * modemans;    //expected answer from modem (NULL for no answer expected);
          int   timeout;       //Max. Timeout in seconds to wait for an answer
          int   retries;       //Number of retries
    }PPPClie_ModemCmd;

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.26V1.26V1.26V1.17V1.17

    Top of list
    Index page

    PPPClie_ModemCtrl


                
    typedef struct tag_pppclie_modem_ctrl
    {
       //idle interval time, at which the pppclient executes the configured control commands
       int ctrl_idle_secs;
       //modem control commands to execute
       PPPClie_ModemCmd ctrlcmd[3];
    }PPPClie_ModemCtrl;
    
    
    Example for a modem control variable:
    
    PPPClie_ModemCtrl modem_ctrl =
    {  20,                // idle interval after which the modem commands are executed
       {{"+++","OK",2,2}, // Switch into modem command mode
                          // If the modem is not connected it doesn't answer with "OK"
                          // -> close ppp session
        {"AT","OK",2,2},  // Check, if the modem is in command mode
        {"ATO",NULL,0,0}  // Switch modem back to online mode
       }
    };

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.26V1.26V1.26V1.17V1.17

    Top of list
    Index page

    PPPClient_Init


                
    typedef struct tag_ppp_client
    {
       int               port;
       int               auth;
       int               modem;
       int               flow;
       long              baud;
       unsigned long     idletimeout;
       char              username[PPP_MAXNAME_LEN];
       char              password[PPP_MAXNAME_LEN];
       void              far * dptr;
    
       char              PPPClieipAddrStr[16];
       char              PPPClieRemipAddrStr[16];
       char              PPPClienetMaskStr[16];
       char              PPPClieipGatewayStr[16];
    
       PPPDial           pppdial[PPP_MAX_DIAL];
       PPP_ModemHangup   modem_hangup;
       int               break_modem;
    } PPPClient_Init;

    Comments

    The PPPClient_Init structure is used to open a PPP client session.   For how to initialize and use these structures see the PPPCLIE.C example.  The structure has the following members:

    auth
      0:    no authentication
      1:    PAP Client must send user name and password for PAP authentication to the peer
      2:    CHAP Client must send user name and password for CHAP authentication to the peer
      3:    PAP Client expects PAP user name and password from the peer
      4:    CHAP Client expects CHAP user name and password from the peer

    modem
      modem usage:
      0: null modem, 1: modem
      2: modem usage with control check enabled (in idle case)
      After each time interval during which the PPP client receive no data, the PPP client executes cyclic in intervals of a defined idle time an user defined set of modem commands to check the status of the modem. The PPP client closes the connection, if the execution of one of these commands failed. The idle interval and the modem command set must be specified at a variable of type PPPClie_ModemCtrl. The PPP client expects the address of this variable at the pointer dptr of the PPPClient_Init structure variable.
      3: modem usage with cyclic control check enabled
      Same as modem == 2 with one difference:
      After each time interval the client executes the configured modem commands. In this mode the configured modem commands are not printed via stdout at execution time, even if MODEMTRACE is enabled.

    baud
      Serial port baud rate

    idletimeout
      Close PPP after this amount of idle time, in seconds.
      (0: No closing after idle time)

    username
      Applicable if auth is non-zero.

    password
      Applicable if auth is non-zero.

    dptr
      If parameter modem==2 (see above), pointer to a variable of type PPPClie_ModemCtrl
      else: Not used.

    PPPClieipAddrStr
      If this IP string is set to "0.0.0.0" then the client expects an IP address from the peer.   This IP string is then updated after a successful connection is established.

      If this string not set to "0.0.0.0" then the client will use this IP address during the PPP session.

    PPPClieRemipAddrStr
      If this IP string is set to "0.0.0.0" then the client allows the peer to use its own IP address during the PPP session.   This string is then updated after a successful connection has been established.

      If this IP string is not set to "0.0.0.0" then the client will configure the remote peer with this IP address.

    PPPClienetMaskStr
      Subnet mask.

    PPPClieipGatewayStr
      Gateway IP address.

    pppdial
      This array of the PPPdial structures is used for initializing and dialing a modem.   These modem commands will be executed at the start of establishing a connection to a PPP server.

    modem_hangup
      This PPP_ModemHangup structure is used when closing the modem connection.

    break_modem
      Flag for interrupting IPC@CHIP®-to-modem communication, break dialing, connect control communication (dialing, waiting for connect).   Setting break_modem to 1 breaks current modem control communication between IPC@CHIP® and the modem at a PPP client open or close call.   The PPP client reads this flag and breaks the dialing if the flag is set.   This flag can be set from another task.   It will not break an established PPP link!   Don't forget to clear this flag to zero after breaking.

    SC1x3/SC2x Comments

    port
      Serial port (0:EXT 1:COM 2:SER2 3:SER3)

    flow
      Serial port flow control: (0: none, 1:XON/XOFF, 2:RTS/CTS)

      The flow control mode XON/XOFF applied to PPP has not been tested.   It is not advisable to use it.   The XON/XOFF mode is also available if the DMA receive mode for the selected serial port is enabled, but due to the internal functionality of DMA it is not possible to immediately detect an XON or XOFF from the peer.   Therefore it is possible that an overrun situation can occur at the connected peer (e.g. GSM modem).   We now offer this mode because some GSM modems support only XON/XOFF flow control.

    SC1x Comments

    port
      Serial port (0:EXT 1:COM)

    flow
      Serial port flow control: (0: none, 1:XON/XOFF, 2:RTS/CTS)

      The flow control mode XON/XOFF applied to PPP has not been tested.   It is not advisable to use it.   Since @CHIP-RTOS 1.02B XON/XOFF mode is also available if the DMA receive mode for the selected serial port is enabled, but due to the internal functionality of DMA it is not possible to immediately detect an XON or XOFF from the peer.   Therefore it is possible that an overrun situation can occur at the connected peer (e.g. GSM modem).   We now offer this mode because some GSM modems support only XON/XOFF flow control.

    Related Topics

    PPP_Client_Open() API - Open PPP client session.
    PPPdial dial-up command data

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page

    PPPClient_Init_IPv6


                
    typedef struct tag_ppp_client_ipv6
    {
       int                port;
       int                auth;
       int                modem;
       int                flow;
       long               baud;
       unsigned long      idletimeout;
       char               username[PPP_MAXNAME_LEN];  // Used if .auth != 0
       char               password[PPP_MAXNAME_LEN];  // Used if .auth != 0
       void       far  *  dptr;                     // dummy ptr
       char               PPPClieipAddrStr[INET6_ADDRSTRLEN];
       char               PPPClieRemipAddrStr[INET6_ADDRSTRLEN];
       PPPDial            pppdial[PPPCLIE_MAX_DIAL];
       PPP_ModemHangup    modem_hangup;
       int                break_modem;
    
    }PPPClient_Init_IPv6;

    Comments

    The PPPClient_Init_IPv6 structure is used to open a PPP client session.   For how to initialize and use these structures see the PPPCLIE.C example.   The structure has the following members:

    port
      Serial port (0:EXT 1:COM 2:SER2 3:SER3)

    auth
      0:    no authentication
      1:    PAP Client must send user name and password for PAP authentication to the peer
      2:    CHAP Client must send user name and password for CHAP authentication to the peer
      3:    PAP Client expects PAP user name and password from the peer
      4:    CHAP Client expects CHAP user name and password from the peer

    modem
      modem usage (0:null modem, 1:modem)

    flow
      Serial port flow control: (0: none, 1:XON/XOFF, 2:RTS/CTS)

    baud
      serial baud rate

    idletimeout
      Close PPP after this amount of idle time, in seconds.
      (0: No closing after idle time)

    username
      Applicable if auth is non-zero.

    password
      Applicable if auth is non-zero.

    dptr
      Not used.

    PPPClieipAddrStr
      Storage for auto configured IPv6 address string.   This will be filled in after the PPP link has been established.

    PPPClieRemipAddrStr
      Storage for auto configured Remote peer IPv6 address string.   This will be filled in after the PPP link has been established.

    pppdial
      This array of the PPPdial structures is used for initializing and dialing a modem.   These modem commands will be executed at the start of establishing a connection to a PPP server.

    modem_hangup
      This PPP_ModemHangup structure is used when closing the modem connection.

    break_modem
      Flag for interrupting IPC@CHIP®-to-modem communication, break dialing, connect control communication (dialing, waiting for connect).   Setting break_modem to 1 breaks current modem control communication between IPC@CHIP® and the modem at a PPP client open or close call.   The PPP client reads this flag and breaks the dialing if the flag is set.   This flag can be set from another task.   It will not break an established PPP link!   Don't forget to clear this flag to zero after breaking.


    Related Topics

    PPP_Client_Open_IPv6() API - Open PPP client session.
    PPPdial dial-up command data

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      n/an/an/aV0.90V1.00


    Top of list
    Index page

    PPPDial


                
    typedef struct tag_pppdial_init
    {
          char far * modemcmd;  // modem command string
          char far * modemans;  // modem answer  string (max. 80 characters + '\0')
          int   timeout;        // seconds, 0 = no time out
          int   retries;        // Maximum number of dial attempts.
          char  expect_send;    // = 0: PPP client sends modem AT command
                                //      and expects modem answer (e.g. OK).
                                // = 1: PPP client expects modem answer
                                //   (e.g. CONNECT) and sends modem command.
    } PPPDial;

    Comments

    The PPPDial structure is used during PPP client dial-up.

    Related Topics

    PPP_Client_Open() API - Open PPP client session
    PPPClient_Init PPP client open data structure

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page

    PPP_IPCfg_Data


                
    typedef struct tag_pppipcfg_data
    {
         char          IP[16];          // PPP server IP
         char          RemIP[16];       // Remote IP (given to the client, if connected)
         char          Netmask[16];     // Subnet mask
         char          Gateway[16];     // Gateway
         unsigned int  comport;         // COM port: EXT=0, COM=1
         unsigned int  auth;            // 0: no authentication 1:PAP 2:CHAP
         unsigned int  modem;           // Analog Modem=1, Null Modem cable=0
         unsigned int  flow;            // Flow control
         long          baud;            // BAUD rate
    
    } PPP_IPCfg_Data;

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page

    PPP_IPCfg_Data_IPv6


                
    typedef struct tag_pppipcfg_data_ipv6
    {
         char          IP[46];          // auto configured PPP server IP
         char          RemIP[46];       // auto configured Remote peer IP
         unsigned int  comport;         // COM port: EXT=0, COM=1
         unsigned int  auth;            // 0: no authentication 1:PAP 2:CHAP
         unsigned int  modem;           // Analog Modem=1, Null Modem cable=0
         unsigned int  flow;            // Flow control
         long          baud;            // BAUD rate
    
    } PPP_IPCfg_Data_IPv6;

    Comments

    The PPP_IPCfg_Data_IPv6 structure is used to read out the configuration of the PPP server.

    Related Topics

    PPP_Server_Get_Cfg_IPv6() API - Get PPP server IPv6 configuration

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      n/an/an/aV0.90V1.00

    Top of list
    Index page

    PPP_ModemHangup


                
    typedef struct tag_pppclie_hangup
    {
          char far *modemcmdmode;    // string for switching modem into command mode e.g. +++
          int      delay;            // delay time after switching in seconds
          PPPDial pppdial[PPP_MAX_DIAL];  // modem commands and answer for hang-up procedure
    
    }PPP_ModemHangup;

    Comments

    The PPP_ModemHangup structure is used when closing a PPP modem connection.

    Related Topics

    PPP_Client_Open() API - Open PPP client session
    PPPClient_Init PPP client open data structure

    Top of list
    Index page

    PPP_Option


    This data structure and associated constants are defined in TCPIPAPI.H header file.   It is used to control PPP options for both the PPP server and client.

                
    typedef struct tag_ppp_option
    {
       int             protocolLevel;     // PPP_LCP_PROTOCOL or PPP_IPCP_PROTOCOL
       int             remoteLocalFlag;   // PPP_OPTION_WANT or PPP_OPTION_ALLOW
       int             optionName;        // From constants defined below
       const char far *optionValuePtr;    // To buffer provided by user
       int             optionLength;      // Number of bytes at *optionValuePtr
    } PPP_Option;
    
     // PPP Protocol levels
     #define PPP_LCP_PROTOCOL     0x21c0  // LCP,  Link control protocol
     #define PPP_IPCP_PROTOCOL    0x2180  // IPCP, Internet protocol control protocol
     #define PPP_PROTOCOL         0x0000  // PPP common
    
     // For .remoteLocalFlag
     #define PPP_OPTION_WANT           0  // What we want to use for our side
     #define PPP_OPTION_ALLOW          1  // What we will allow the remote side to use
    
     // Protocol options for .optionName field
     // LCP protocol options
     #define PPP_LCP_MAX_RECV_UNIT     1  // Maximum receive unit
     #define PPP_LCP_ACCM              2  // Async Ctrl Char Map
     #define PPP_LCP_AUTH_PROTOCOL     3  // Authentication, def. 0, else PPP_PAP or PPP_CHAP
     #define PPP_LCP_PROTOCOL_COMP     7  // Turn On/Off protocol field compression
     #define PPP_LCP_ADDRCONTROL_COMP  8  // Turn ON/OFF address/control field compression
     #define PPP_LCP_TERM_RETRY        9  // Terminate retries,
     #define PPP_LCP_CONFIG_RETRY      10 // Config retries,
     #define PPP_LCP_TIMEOUT           11 // Retransmission timeout in seconds
     #define PPP_LCP_MAX_FAILURES      12 // LCP maximum failure
    
     // IPCP protocol options
     #define PPP_IPCP_COMP_PROTOCOL    2  // VJ-TCP/IP header compression
     #define PPP_IPCP_IP_ADDRESS       3  // IP Address the requesting system wishes to use
     #define PPP_IPCP_VJ_SLOTS         4  // Number of VJ slots
     #define PPP_IPCP_RETRY            5  // IPCP Timeout, retry options
     #define PPP_IPCP_TIMEOUT          6  // IPCP timeout seconds
     #define PPP_IPCP_MAX_FAILURES     7  // LCP maximum failures
     #define PPP_IPCP_DNS_PRI         29  // Specify DNS prim. server IP
     #define PPP_IPCP_DNS_SEC         31  // Specify DNS sec.  server IP
    
     //PPP options
     #define PPP_SEND_BUFFER_SIZE      1  // Data buffered by PPP link layer,
                                          // before the device driver send function
                                          // is called, length 2, def. 1 (Byte)
    
     //Authentication constants
     #define PPP_PAP              0x23c0  // PAP authentication
     #define PPP_CHAP             0x23c2  // CHAP authentication

    Comments

    The type of data found at the location referenced by the optionValue member varies depending on the particular PPP option that is being dealt with.

    When manipulating socket options, the protocol_level at which the option resides and the name of the option (optionName member) must be specified.

    The size of the buffer required pointed to by the optionValue member depends on the option.   These sizes (in bytes) are stated at the descriptions list below.   The parameters optionValue and optionLength are used to access option values.

    The structure member remoteLocalFlag can have two possible values:
         PPP_OPTION_WANT   or   PPP_OPTION_ALLOW.

    With remoteLocalFlag set to PPP_OPTION_WANT, the IPC@CHIP® sends a PPP configuration request to the connected peer which contains the specified option.

    With remoteLocalFlag set to PPP_OPTION_ALLOW, the IPC@CHIP® accepts an incoming PPP configuration request from the connected peer for the specified option.

    The following list specifies the PPP options for the two different protocol levels, including a short description and the length of the option needed for setting the optionLength member.   Protocol level and optionName constants referred to here are defined in TCPIPAPI.H

    protocolLevel=PPP_LCP_PROTOCOL     (Link Control Protocol level options)
    • optionName=PPP_LCP_ADDRCONTROL_COMP:    Size: 8 bit, sizeof(char) - Activate/Deactivate address control compression, default 0: Deactivated
    • optionName=PPP_LCP_PROTO_COMP:    Size: 8 bit, sizeof(char) - Value 1: Protocol field compression, default 0: No compression
    • optionName=PPP_LCP_ACCM:    Size: 32 bit, sizeof(long) - Set Async control character map.   Each bit position of the unsigned long value represents the corresponding character which should be escaped or not during PPP session.
    • optionName=PPP_LCP_MAX_RECV_UNIT:    Size: 16 bit, sizeof(int) - Maximum receive unit, default 1500 (bytes)
    • optionName=PPP_LCP_AUTH_PROTOCOL:    Size: 16 bit, sizeof(int) - Authentication method, default 0 (no Auth.), possible PPP_PAP or PPP_CHAP
    • optionName=PPP_LCP_TERM_RETRY :    Size: 8 bit, sizeof(char) - Terminate retries, default 3
    • optionName=PPP_LCP_CONFIG_RETRY :    Size: 8 bit, sizeof(char) - Config retries, default 10
    • optionName=PPP_LCP_TIMEOUT:    Size: 8 bit, sizeof(char) - Retransmission timeout in seconds, default 3 (seconds)
    • optionName=PPP_LCP_MAX_FAILURES :    Size: 8 bit, sizeof(char) - LCP maximum failures ,default 5

    protocolLevel=PPP_IPCP_PROTOCOL     (IpCp level options)
    • optionName=PPP_IPCP_COMP_PROTOCOL:    Size: 16 bit, sizeof(int) - Value 1: VJ TCP/IP header compression, default 0: No compression
    • optionName=PPP_IPCP_DNS_PRI:    Size: 32 bit, sizeof(long) - Specifies the IP addresses of the primary DNS server we will allow the remote to use or the primary DNS server we want to use.   If this option is called with the value 0 and remotelocalflag==PPP_OPTION_WANT, then we allow the connected peer to report their primary DNS server IP.
    • optionName=PPP_IPCP_DNS_SEC:    Size: 32 bit, sizeof(long) - Specifies the IP addresses of the secondary DNS server we will allow the remote to use or the secondary DNS server we want to use.   If this option is called with the value 0 and remotelocalflag==PPP_OPTION_WANT, then we allow the connected peer to report their primary DNS server IP.
    • optionName=PPP_IPCP_IP_ADDRESS:    Size: 32 bit, sizeof(long) - The IP Address the requesting system wishes to use, default 0 (not allowed) By default the remote is not allowed to request its IP and/or DNS IP addresses If PPPSetOption is called with OPTION_ALLOW, and value 0, the remote will be allowed to set its addresses.
    • optionName=PPP_IPCP_VJ_SLOTS :    Size: 1 bit, sizeof(char) - Number of VJ slots, default 1 (slot)
    • optionName=PPP_IPCP_RETRY:    Size: 1 bit, sizeof(char) - IPCP Timeout, retry options, default 10
    • optionName=PPP_IPCP_TIMEOUT:    Size: 1 bit, sizeof(char) - IPCP timeout seconds, default 1 (second)
    • optionName=PPP_IPCP_MAX_FAILURES :    Size: 1 bit, sizeof(char) - LCP maximum failures, def. 5

    If the option PPP_IPCP_PROTOCOL (VJ TCP/IP header compression) is set, it can be possible that the FTP server of the IPC@CHIP® is not usable via the PPP interface.

    Related Topics

    API function PPP_Client_SetOptions() - Set PPP client options
    API function PPP_Server_SetOptions() - Set PPP server options
    API function PPP_Client_Get_DNSIP() - Get DNS IP
    API function Dev_PPP_Set_Option() - Set PPP option for user device drivers

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page

    recv_params


                
    struct recv_params
    {
       char          far      *bufferPtr;        // Store incoming data here
       int                     bufferLength;     // Maximum bytes to store
       int                     flags;            // Blocking, timeout or no wait
       struct sockaddr  far   *fromPtr;          // Only needed for UDP.
       int              far   *fromlengthPtr;    // Only needed for UDP.
       unsigned long           timeout;          // timeout milliseconds
    };

    Comments

    This structure is defined in tcpip.h.

    bufferPtr
      This output parameter specifies the user buffer into which the received data will be placed by the system.

    bufferLength

      Size of user buffer at bufferPtr, places upper limit on bytes transferred.

    flags

      Set to one of following constants defined in tcpip.h:
        MSG_BLOCKING:   Sleep until data comes in
        MSG_TIMEOUT :   The caller wakes up after timeout or if data comes in.   The structure member timeout must be set.
        MSG_DONTWAIT:   Return immediately

    fromlengthPtr     UDP only

      The 16 bit value referenced by this pointer is both an input and output parameter, which should be preset to:

          sizeof(struct sockaddr_in)

      prior to calling recvfrom().


    timeout
      If flags is set to MSG_TIMEOUT, then the maximum number of milliseconds to wait should be specified here. The timeout resolution is 100 milliseconds.

    SC1x Comments


    fromPtr     UDP only
      This is an output parameter.   The referenced sockaddr structure is cast to a sockaddr_in structure prior to usage.   This field will be set by the system inside the recvfrom() call to indicate the origin of the received UDP data.

    SC1x3/SC2x Comments


    fromPtr     UDP only
      This is an output parameter.   The referenced sockaddr sockaddr structure is cast to a sockaddr_in structure (AF_INET IPv4 sockets)
      or to a sockaddr_in6 structure (AF_INET6 IPv6 sockets) prior to usage.  

      This field will be set by the system inside the recvfrom() call to indicate the origin of the received UDP data.


    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page

    Route_Entry


                
    typedef struct tag_route_entry{
         unsigned long destIPAddress;  // The IP address to add the route for
         unsigned long destNetmask;    // The netmask for the route
         unsigned long gateway;        // IP address of the gateway for this route
         int hops;                     // Number of routers between this host and route
    } Route_Entry;

    SC1x3/SC2x Comments

    At the current SC1x3/SC2x CHIP-RTOS version routing functions are existing only for IPv4 protocol.

    Related Topics

    API function AddStaticRoute() - Add a route for an interface
    API function DelStaticRoute() - Delete a route from an interface

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page

    send_params


                
    struct send_params
    {
       char             far   *bufferPtr;        // Pointer to send data
       int                     bufferLength;     // Number of bytes to send
       int                     flags;            // Blocking or no wait
       struct sockaddr  far   *toPtr;            // only needed for UDP
       int              far   *tolengthPtr;      // only needed for UDP
    };

    Comments

    This structure is defined in tcpip.h.   The elements are used as follows:

    bufferPtr
      Pointer to data to be sent.

    bufferLength
      Number of bytes to be sent from bufferPtr.

    flags
      Set to one of following constants defined in tcpip.h:
        MSG_BLOCKING:   Sleep until data is transferred into the socket transmit queue
        MSG_DONTWAIT:   Return immediately after loading bytes into available transmit queue space

    tolengthPtr     UDP only

      The 16 bit value referenced by this pointer must be:       sizeof(struct sockaddr_in)

    SC1x Comments


    toPtr     UDP only
      The referenced structure is cast to a sockaddr_in structure prior to usage.   The datagram destination IP address and port number is specified here by caller.

    SC1x3/SC2x Comments


    toPtr     UDP only
      The referenced structure is cast to a sockaddr_in structure (AF_INET IPv4 sockets)
      or to a sockaddr_in6 structure (AF_INET6 IPv6 sockets) prior to usage.
         The datagram destination IP address and port number is specified here by caller.

    Related Topics

    API function opensocket_ext() - Open IPv6 socket
    API function opensocket() - Open IPv4 socket

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page

    SetSocketOption


    This data structure is defined in the TCPIPAPI.H library header file.

                
    typedef struct tag_setsockopt
    {
        int     protocol_level;      // Protocol level: IP level, TCP level or socket level
        int         optionName;      // Option's name constant
        const char far *optionValue; // Pointer to the option value (type varies)
        int        optionLength;     // Length of option value data
    
    } SetSocketOption;
    
     // Example usage of SetSocketOption type to set
     // IP Time-to-Live to 69 seconds (or router hops)
     // using C-Library function setsockopt():
    
     unsigned char time_to_live = 69;
     int error ;
     int socketdescriptor;  // You must initialize this (not shown here)
     SetSocketOption sockopt = {IP_PROTOIP_LEVEL,            // .protocol_level
                                IPO_TTL,                     // .optionName
                          (const char far *)&time_to_live,   // .optionValue
                                sizeof(unsigned char)};      // .optionLength
    
     setsockopt (socketdescriptor, &sockopt &error) ;

    Comments

    The type of data found at the location referenced by the optionValue member varies depending on the particular socket option that is being dealt with.

    Related Topics

    For list of options and sizes see GetSocketOption()
    API function setsockopt() - Set socket options

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page

    sockaddr


                
    struct sockaddr
    {
        unsigned char  sa_len;      // Total Length
        unsigned char  sa_family;   // Address Family AF_xxx
        char           sa_data[14]; // up to 14 bytes of protocol specific stuff
    };

    Comments

    This generic "one size fits all" BSD structure is treated as a sockaddr_in structure within the TCP/IP API functions.

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page

    sockaddr_in


    Socket data structure

    SC1x:

                
    struct sockaddr_in
    {
       short           sin_family;  // AF_INET
       unsigned short  sin_port;    // 16 bit Port Number in network byte order
       struct  in_addr sin_addr;    // 32 bit netid/hostid in network byte order
       char            sin_zero[8]; // unused
    };

    SC1x3/SC2x:

                
    struct sockaddr_in
    {
      unsigned char   sin_len;     //
      unsigned char   sin_family;  // AF_INET
      unsigned int    sin_port;    // 16bit Port Number in network byte order
      struct  in_addr sin_addr;    // 32bit netid/hostid in network byte order
      char            sin_zero[8]; // unused
    };

    Comments

    The sin_family member should be set to AF_INET (=2).
    The sin_addr member's in_addr structure is simply a long IP address in big endian byte order.

    The htons() function can be used to convert port numbers to network byte order.

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page

    sockaddr_in6


    Data structure required by the 4.4BSD socket API used to represent an IPv6 address

                
    struct sockaddr_in6
    {
        unsigned char    sin6_len;       //Length (in bytes) of the sockaddr_in6 structure
        unsigned char    sin6_family;    //Address family, set to AF_INET6
        unsigned short   sin6_port;      //Transport layer port number
        unsigned long    sin6_flowinfo;  //IPv6 packet header Flow Label
        struct in6_addr  sin6_addr;      //128-bit IPv6-formatted address in network byte order.
        unsigned long    sin6_scope_id;  //sin6_scope_id for local scope
                                         // (i.e. link-local, site-local)
                                         // unicast IPv6 addresses
    };

    Comments

    The sin6_len is the length in bytes of struct sockaddr_in6.

    The sin6_family member should be set to AF_INET6.
    Note that an IPv4-only IP address can be represented as a 128-bit IPv6-formatted IP Address.
    The socket API refers to this as an IPv4-mapped IPv6 address. In this case, sin6_family is set to AF_INET6, even though the structure contains an IPv4-only IP Address.
    However, internally the stack treats it as an IPv4-only IP address.

    The sin6_flowinfo member contains the IPv6 packet header Flow Label as the low-order 20 bits and Traffic Class as the next more significant 8 bits. The high-order 4 bits of this field are reserved. This field allows the application to set the flow label and traffic class associated with the socket via a call to bind or connect.

    Related Topics

    See in6_addr structure
    See sockaddr_storage structure
    See sockaddr_in structure

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      n/an/an/aV0.90V1.00

    Top of list
    Index page

    sockaddr_storage


    Because the sockaddr type isn't big enough to hold an IPv6 address, the sockaddr_storage type is provided which can hold either an IPv4 or an IPv6 address.

                
    struct sockaddr_storage
    {
        union
        {
            struct sockaddr_in6     ipv6;
            struct sockaddr_in      ipv4;
        } addr;
    };

    Related Topics

    See sockaddr_in6 structure
    See sockaddr_in structure

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      n/an/an/aV0.90V1.00

    Top of list
    Index page

    SocketInfo


                
    typedef struct tag_socket_info{
            unsigned int  socIndex;
            unsigned char protocol;        // 6: TCP   17: UDP
            unsigned int  localPort;       // Little endian!
            unsigned long IfIpAddress;     // network byte order
            unsigned int  remotePort;      // Little endian!
            unsigned long remoteIP;        // network byte order
            unsigned char tcpState;
    } SocketInfo;

    Comments

    Note that the localPort and remotePort members are in little endian format, while the two IP addresses remain in network byte order (big endian).

      Possible TCP socket states:
      0       CLOSED
      1       LISTEN
      2       SYN_SENT
      3       SYN_RECEIVED
      4       ESTABLISHED
      5       CLOSE_WAIT
      6       FIN_WAIT_1
      7       CLOSING
      8       LAST_ACK
      9       FIN_WAIT_2
      10     TIME_WAIT
      20     INVALID

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.10V1.00V1.00V0.90V1.00

    Top of list
    Index page

    SocketInfoIpv4v6


                
    typedef struct tag_socket_info{
            unsigned int  socIndex;
            unsigned char protocol;        // 6: TCP   17: UDP
            unsigned int  localPort;       // Little endian!
            struct in6_addr IfIpAddress;   // network byte order
            unsigned int  remotePort;      // Little endian!
            struct in6_addr remoteIP;      // network byte order
            unsigned char tcpState;
    } SocketInfo;

    Comments

    Note that the localPort and remotePort members are in little endian format, while the two IP addresses remain in network byte order (big endian).

    Possible TCP socket states:
      0       CLOSED
      1       LISTEN
      2       SYN_SENT
      3       SYN_RECEIVED
      4       ESTABLISHED
      5       CLOSE_WAIT
      6       FIN_WAIT_1
      7       CLOSING
      8       LAST_ACK
      9       FIN_WAIT_2
      10     TIME_WAIT
      20     INVALID

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      n/an/an/aV0.90V1.00

    Top of list
    Index page

    SSL_SESSION_NEW_Entry


                
    typedef struct tag_ssl_session_new_entry
    {
      char far *    certIdentity; // SSL server/client own certificate name
      unsigned int  maxCaches;    // Maximum number of caches for this session
      int           version;      // The SSL version number for this session
                                  // Bit0: SSL 3.0
                                  // Bit1: TLS 1.0
    } SSL_SESSION_NEW_Entry;

    Comments

    If the value in maxCaches is zero, there is no cache at all. That means there is no connection resumption at all either. Note that each cache entry will consume about 100 bytes memory.

    Related Topics

    API function SSL_SessionNew() - Open a new SSL session

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      n/an/an/aV0.91V1.00

    Top of list
    Index page

    TcpMib


                
    typedef struct tagTcpMib
    {
       long                tcpRtoAlgorithm;  // retransmission timeout algorithm
       long                tcpRtoMin;        // minimum retransmission timeout (mS)
       long                tcpRtoMax;        // maximum retransmission timeout (mS)
       long                tcpMaxConn;       // maximum TCP connections possible
       unsigned long       tcpActiveOpens;   // number of SYN-SENT -> CLOSED transitions
       unsigned long       tcpPassiveOpens;  // number of SYN-RCVD -> LISTEN transitions
       unsigned long       tcpAttemptFails;  //(SYN-SENT,SYN-RCVD)->CLOSED or SYN-RCVD->LISTEN
       unsigned long       tcpEstabResets;   // (ESTABLISHED,CLOSE-WAIT) -> CLOSED
       unsigned long       tcpCurrEstab;     // number in ESTABLISHED or CLOSE-WAIT state
       unsigned long       tcpInSegs;        // number of segments received
       unsigned long       tcpOutSegs;       // number of segments sent
       unsigned long       tcpRetransSegs;   // number of retransmitted segments
       unsigned long       tcpInErrs;        // number of received errors
       unsigned long       tcpOutRsts;       // number of transmitted resets
    } TcpMib;

    SC1x Comments

    These structures are only available in SC1x @CHIP-RTOS versions which contain the SNMP option.   A SNMP agent is not part of the @CHIP-RTOS.   But if a user is able to implement an agent based on the TCP/IP API, they need access to the internal TCP/IP SNMP variables.

    Related Topics

    API function Get_SNMP_Data() - Get internal TCP/IP SNMP variables

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.02V1.00V1.00V0.90V1.00

    Top of list
    Index page

    timeval


                
    struct timeval {
      long    tv_sec;         // seconds
      long    tv_usec;        // and microseconds
    };

    Comments

    This data structure is used to specify the maximum wait time for the select() API.   Set both members to zero for polling.   The @Chip-RTOS timing resolution within the select() is to one millisecond.   Nevertheless, the tv_usec is specified in microseconds here for consistancy with the Berkely Sockets standard.

    Inside the @Chip-RTOS this all is going to be converted to a 31 bit number of milliseconds.   So values for tv_sec greater than (2**31)/1000 seconds (= ~24 days) will overflow and therefore not provide your requested wait time.

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.22V1.22V1.22V1.11V1.00

    Top of list
    Index page

    UdpMib


                
    typedef struct tagUdpMib
    {
        unsigned long       udpInDatagrams; // UDP datagrams delivered to users
        unsigned long       udpNoPorts;     // UDP datagrams to port with no listener
        unsigned long       udpInErrors;    // UDP datagrams unable to be delivered
        unsigned long       udpOutDatagrams;// UDP datagrams sent from this entity
    } UdpMib;

    SC1x Comments

    These structures are only available in SC1x @CHIP-RTOS versions which contain the SNMP option.   A SNMP agent is not part of the @CHIP-RTOS.   But if a user is able to implement an agent based on the TCP/IP API, they need access to the internal TCP/IP SNMP variables.

    Related Topics

    API function Get_SNMP_Data() - Get internal TCP/IP SNMP variables

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.02V1.00V1.00V0.90V1.00

    Top of list
    Index page

    UserEthDhcp_Entry


                
    typedef struct tag_UserDhcpEthEntry
    {
        unsigned long   BootSIpAddress;      // BOOT Server (TFTP server), not supported
        unsigned long   Dns1ServerIpAddress; // Domain name server
        unsigned long   Dns2ServerIpAddress; // Second domain name server
        unsigned long   Yiaddr;              // Our (leased) IP address
        unsigned long   NetMask;             // Our subnet mask
        unsigned long   DefRouter;           // Default router
        unsigned long   DhcpServerId;        // DHCP selected server IP address
        unsigned long   internal1;           // Internal use only
        unsigned long   internal2;           // Internal use only
        unsigned long   DhcpLeaseTime;       // DHCP Address lease time in milliseconds
        unsigned long   internal3;           // internal use only
        unsigned long   internal4;           // internal use only
        unsigned char   DomainName[64];      // Domain name
        unsigned char   BootSname[64];       // TFTP server name, not used
        unsigned char   BootFileName[128];   // Boot file name (for TFTP download),
                                             //   not supported.
        unsigned short  BootFileSize;        // Boot file size in 512 Bytes blocks
                                             //    (for TFTP download).
        unsigned short  internal5;           // internal use only
    } UserEthDhcp_Entry;

    Comments

    Members of this structure hold the DHCP configuration data if the IPC@CHIP® is configured by a DHCP server.

    This is read only information!

    Related Topics

    API function Get_DHCP_Status() - Get DHCP status of the internal Ethernet interface of the IPC@CHIP®
    API function Dev_Wait_DHCP_Complete() - Get DHCP status for a user Ethernet interface

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page


    End of document