Files
m241Neelima/components/ip_net2-6.9/iplite2/include/iplite.h
T
2026-07-30 11:19:44 +05:30

279 lines
8.5 KiB
C

/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: iplite.h,v $ $Revision: 1.14.10.1 $
* $Source: /home/interpeak/CVSRoot/iplite2/include/iplite.h,v $
* $Author: ulf $ $Date: 2011-11-16 10:33:37 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Kenneth Jonsson <kenneth@interpeak.se>
******************************************************************************
*/
#ifndef IPLITE_H
#define IPLITE_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "iplite_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipcom_sock.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
*===========================================================================
* IPLITE_RELEASE
*===========================================================================
* IPLITE release version.
*/
#define IPLITE_RELEASE 60600
/*
*===========================================================================
* IPLITE_CTRL bases
*===========================================================================
*/
#define IPLITE_CTRL_SOCK_BASE 0x0800
#define IPLITE_CTRL_NC_ENTRY_BASE 0x1000
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
*===========================================================================
* iplite tag
*===========================================================================
*/
struct Iplite_tag
{
Ip_u16 type; /* Tag type (IPLITE_CTRL_xxx value) */
Ip_u16 size; /* The size of the tag in octets */
};
/*
*===========================================================================
* sock tag
*===========================================================================
*/
struct Iplite_tag_sock_data
{
struct Iplite_tag hdr;
/* The filedescriptor for the socket */
int fd;
int domain;
int type;
int protocol;
/* Only valid if protocol is IP_IPPROTO_TCP */
int tcp_state;
/* Source and destination addresses */
union
{
struct Ip_sockaddr addr;
struct Ip_sockaddr_in in_addr;
#ifdef IPCOM_USE_INET6
struct Ip_sockaddr_in6 in6_addr;
#endif
} saddr;
union
{
struct Ip_sockaddr addr;
struct Ip_sockaddr_in in_addr;
#ifdef IPCOM_USE_INET6
struct Ip_sockaddr_in6 in6_addr;
#endif
} daddr;
};
/* Start a new enumeration of socket data */
#define IPLITE_CTRL_NEW_ENUM_SOCK_DATA (IPLITE_CTRL_SOCK_BASE | 1)
/* Continue enumeration of socket data */
#define IPLITE_CTRL_CONT_ENUM_SOCK_DATA (IPLITE_CTRL_SOCK_BASE | 2)
/*
*===========================================================================
* Ipnet_rt_metrics
*===========================================================================
*/
struct Iplite_rt_metrics
{
#if defined(IPNGC) || defined(IP_PORT_OSE5)
Ip_u32 rmx_locks; /* Unsupported! */
#endif
Ip_u32 rmx_mtu; /* MTU for this path */
Ip_u32 rmx_hopcount; /* Max hops expected */
Ip_u32 rmx_expire; /* Lifetime for route, e.g. redirect */
#if defined(IPNGC) || defined(IP_PORT_OSE5)
Ip_u32 rmx_recvpipe; /* Unsupported! */
Ip_u32 rmx_sendpipe; /* Unsupported! */
Ip_u32 rmx_ssthresh; /* Unsupported! */
#endif
Ip_u32 rmx_rtt; /* Estimated round trip time */
Ip_u32 rmx_rttvar; /* Estimated rtt variance */
#ifdef IP_PORT_OSE5
Ip_u8 rmx_proto; /* User defined protocol */
Ip_u8 rmx_usr1; /* User defined value */
Ip_u16 rmx_usr2; /* User defined value */
Ip_u32 rmx_usr3; /* User defined value */
#endif
};
#define Ipnet_rt_metrics Iplite_rt_metrics
/*
*===========================================================================
* ip6 neighbor cache tag
*===========================================================================
*/
#ifdef IPCOM_USE_INET6
struct Iplite_tag_nc_entry
{
struct Iplite_tag hdr;
/* Filled by caller for ADD, by callee for ENUM and ignored for DEL */
/* Interface index (set to 0 to let the stack choose). */
Ip_u32 ifindex;
/* Filled by by callee for ENUM and ignored for ADD and DEL status */
int status;
/* Is this a router (currently ignored for ADD) */
Ip_bool is_router;
/* Filled by caller for ADD, by callee for ENUM and ignored for DEL.
* Number of seconds before the entry expires (or IPLITE_INFINTE)
*/
Ip_u32 expires_sec;
/* Filled by caller for ADD and DEL and by callee for ENUM.
* A IPv6 address
*/
struct Ip_sockaddr_in6 addr;
/* Link address */
struct Ip_sockaddr_dl link_addr;
};
/* Start a new enumeration of neighbor cache entries */
#define IPLITE_CTRL_NEW_ENUM_NC_ENTRY (IPLITE_CTRL_NC_ENTRY_BASE | 1)
/* Continue enumeration of neighbor cache entries */
#define IPLITE_CTRL_CONT_ENUM_NC_ENTRY (IPLITE_CTRL_NC_ENTRY_BASE | 2)
/* Add neighbor cache entry */
#define IPLITE_CTRL_ADD_NC_ENTRY (IPLITE_CTRL_NC_ENTRY_BASE | 3)
/* Delete neighbor cache entry */
#define IPLITE_CTRL_DEL_NC_ENTRY (IPLITE_CTRL_NC_ENTRY_BASE | 4)
#endif /* IPCOM_USE_INET6 */
/*
****************************************************************************
* 6 PROTOTYPES
****************************************************************************
*/
/*
*===========================================================================
* iplite_ctrl_islocked
*===========================================================================
* Description: SNMP helper function to access ndp tables.
* Code semaphore must be locked.
* Parameters: tag - The data to set or get.
* Returns: 0 = succcess, -1 = error
* (get error code from ipcom_errno)
*
*/
#if defined(IPCOM_USE_MIB2) && defined(IPCOM_USE_INET6)
IP_GLOBAL int iplite_ctrl_islocked(struct Iplite_tag *tag);
#endif
/*
*===========================================================================
* iplite_ctrl
*===========================================================================
* Description: Returns, sets or deletes addresses, socket data, etc. in IPLITE.
* Parameters: tag - Pointer to a tag, the memory area must be initialized
* to zero before excecuting a GET for the first time.
* The content returned must be passed if a list of values should
* be returned. tag->hdr.type must be on of the IPLITE_CTRL_xxx
* values defined below.
* Returns: 0 >= success (IPLITE_CTRL_SUCCESS or IPLITE_CTRL_ENUM_DONE)
* -1 = error (get errorcode from IPLITE_P_GET_ERRNO()).
*
*/
IP_PUBLIC int iplite_ctrl(struct Iplite_tag *tag);
/* iplite_ctrl() return values */
#define IPLITE_CTRL_SUCCESS 0 /* Success */
#define IPLITE_CTRL_ENUM_DONE 1 /* Success, enumerated past last element */
#define IPNET_PING_CMD_NO_PING_IN_PROGRESS 0
#define IPNET_PING_CMD_PINGING 1
#define IPNET_PING_CMD_REQUEST_STOP 2
#define IPNET_PING_CMD_STOPPED 3
IP_PUBLIC int iplite_cmd_route(int argc, char **argv);
IP_PUBLIC int iplite_cmd_ifconfig(int argc, char **argv);
IP_PUBLIC int iplite_cmd_ifconfig_common(int argc, char **argv);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/