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

320 lines
12 KiB
C

/******************************************************************************
* INTERPEAK API HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmpls.h,v $ $Revision: 1.26.10.1 $
* $Source: /home/interpeak/CVSRoot/ipmpls/include/ipmpls.h,v $
* $Author: hxie $ $Date: 2012-11-26 08:00:33 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Jonas Rendel <Jonas.Rendel@interpeak.se>
******************************************************************************
*/
#ifndef IPMPLS_H
#define IPMPLS_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipmpls_config.h"
#include <ipcom_type.h>
#include <ipcom_netif.h>
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/* IPMPLS release XYyZz,
X = major version
Yy = minor version (two different versions might be incompatible)
Zz = patch version (two different versions are always compatible) */
#define IPMPLS_RELEASE 60900
/*
*===========================================================================
* IPMPLS ioctls
*===========================================================================
* IO controls handled by the IPMPLS module
*/
#ifndef IPMPLS_PORT_IOCTL
#define IPMPLS_SIOCGLABELSPACEMPLS IP_IOR(MPLS, 1, R, struct Ipmpls_labelspace_req) /* Get MPLS label space for a certain interface */
#define IPMPLS_SIOCSLABELSPACEMPLS IP_IOW(MPLS, 2, R, struct Ipmpls_labelspace_req) /* Set MPLS label space for a certain interface */
#define IPMPLS_SIOCMPLSTUNNELADD IP_IOW(MPLS, 3, R, struct Ip_ifreq) /* Create a MPLS tunnel interface */
#define IPMPLS_SIOCMPLSTUNNELDEL IP_IOW(MPLS, 4, R, struct Ip_ifreq) /* Delete a MPLS tunnel interface */
#define IPMPLS_SIOCMPLSNHLFESETMTU IP_IOW(MPLS, 5, R, struct Ipmpls_out_label_req) /* Change MTU for a certain NHLFE */
#define IPMPLS_SIOCMPLSNHLFEADD IP_IOW(MPLS, 6, R, struct Ipmpls_out_label_req) /* Add a NHLFE entry */
#define IPMPLS_SIOCMPLSNHLFEDEL IP_IOW(MPLS, 7, R, struct Ipmpls_out_label_req) /* Delete a NHLFE entry */
#define IPMPLS_SIOCMPLSNHLFEGET IP_IOR(MPLS, 8, R, struct Ipmpls_out_label_req) /* Get info about a NHLFE entry */
#define IPMPLS_SIOCMPLSILMADD IP_IOW(MPLS, 9, R, struct Ipmpls_in_label_req) /* Add an ILM entry */
#define IPMPLS_SIOCMPLSILMDEL IP_IOW(MPLS,10, R, struct Ipmpls_in_label_req) /* Delete an ILM entry */
#define IPMPLS_SIOCMPLSILMGET IP_IOR(MPLS,11, R, struct Ipmpls_in_label_req) /* Get info about an ILM entry */
#define IPMPLS_SIOCMPLSXCADD IP_IOW(MPLS,12, R, struct Ipmpls_xconnect_req) /* Add a cross-connect reference */
#define IPMPLS_SIOCMPLSXCDEL IP_IOW(MPLS,13, R, struct Ipmpls_xconnect_req) /* Delete a cross-connect reference */
#define IPMPLS_SIOCMPLSXCGET IP_IOR(MPLS,14, R, struct Ipmpls_xconnect_req) /* Get info about a cross-connect reference */
#define IPMPLS_SIOCMPLSILMFLUSH IP_IOW(MPLS,15, R, void*) /* Flush the IPMPLS ILM table */
#define IPMPLS_SIOCMPLSNHLFEFLUSH IP_IOW(MPLS,16, R, void*) /* Flush the IPMPLS NHLFE table */
#define IPMPLS_SIOCSMPLSININSTR IP_IOW(MPLS,17, R, struct Ipmpls_instr_req) /* Set MPLS label operations on an ILM entry */
#define IPMPLS_SIOCGMPLSININSTR IP_IOR(MPLS,18, R, struct Ipmpls_instr_req) /* Get MPLS label operations that are defined on an ILM entry */
#define IPMPLS_SIOCSMPLSOUTINSTR IP_IOW(MPLS,19, R, struct Ipmpls_instr_req) /* Set MPLS label operations on a NHLFE entry */
#define IPMPLS_SIOCGMPLSOUTINSTR IP_IOR(MPLS,20, R, struct Ipmpls_instr_req) /* Get MPLS label operations that are defined on an NHLFE entry */
#define IPMPLS_SIOCMPLSTUNNELMAP IP_IOW(MPLS,21, R, struct Ip_ifreq) /* Map a ILM to a certain tunnel interface */
/*
*===========================================================================
* IPMPLS ioctls
*===========================================================================
* IO controls handled by the IPMPLS tunnel interface
*/
#define IPMPLS_SIOCMPLSTUNNELADDOUT IP_IOW(NETIF, 200, R, struct Ip_ifreq)
#define IPMPLS_SIOCMPLSTUNNELDELOUT IP_IOW(NETIF, 201, R, struct Ip_ifreq)
#define IPMPLS_SIOCMPLSTUNNELGETOUT IP_IOW(NETIF, 202, R, struct Ip_ifreq)
#endif /* IPMPLS_PORT_IOCTL */
/*
*===========================================================================
* IPMPLS label operation codes
*===========================================================================
*/
#define IPMPLS_OP_BASE 0
#define IPMPLS_OP_NOP (IPMPLS_OP_BASE + 0) /* No operation */
#define IPMPLS_OP_POP (IPMPLS_OP_BASE + 1) /* Pop the top label from the label stack */
#define IPMPLS_OP_PEEK (IPMPLS_OP_BASE + 2) /* Lookup the top label of the label stack, perform actions according to the associated ILM */
#define IPMPLS_OP_PUSH (IPMPLS_OP_BASE + 3) /* Push a new label on to the label stack */
#define IPMPLS_OP_DLV (IPMPLS_OP_BASE + 4) /* Deliver the PDU to IPNET.*/
#define IPMPLS_OP_FWD (IPMPLS_OP_BASE + 5) /* Apply a given NHLFE and forward the packet further */
#define IPMPLS_OP_SET (IPMPLS_OP_BASE + 10) /* Set outgoing interface and next hop destination before transmision. */
#define IPMPLS_OP_SET_RX (IPMPLS_OP_BASE + 11) /* Set specific receiving interface on a rx packet */
#define IPMPLS_OP_SET_VR (IPMPLS_OP_BASE + 12) /* Set specific virtual route table index on a rx packet */
#define IPMPLS_OP_SET_RTAB IPMPLS_OP_SET_VR
#define IPMPLS_OP_MAX IPMPLS_OP_SET_RTAB
/*
*===========================================================================
* IPMPLS label directions
*===========================================================================
* Describes the direction of the label operations. Used in the
* struct Ipmpls_instr_elem and struct Ipmpls_instr_req.
*/
#define IPMPLS_IN 0x10
#define IPMPLS_OUT 0x20
/*
*===========================================================================
* IPMPLS label types
*===========================================================================
* MPLS label types supported by IPMPLS
*/
#define IPMPLS_LABEL_TYPE_GEN 1
#define IPMPLS_LABEL_TYPE_KEY 4
/*
*===========================================================================
* IPMPLS label types
*===========================================================================
* MPLS label types supported by IPMPLS
*/
#define IPMPLS_NUM_OPS 8
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
*===========================================================================
* Ipmpls_label
*===========================================================================
*/
typedef struct Ipmpls_label
{
int __refcnt;
int ml_type;
union {
Ip_u32 ml_gen;
Ip_u32 ml_key;
} u;
int ml_index;
}
Ipmpls_label;
/*
*===========================================================================
* Ipmpls_nexthop_info
*===========================================================================
*/
typedef struct Ipmpls_nexthop_info
{
Ip_u32 mni_if;
union
{
struct Ip_sockaddr sa;
#ifdef IPCOM_USE_INET
struct Ip_sockaddr_in sin;
#endif /* IPCOM_USE_INET */
#ifdef IPCOM_USE_INET6
struct Ip_sockaddr_in6 sin6;
#endif /* IPCOM_USE_INET6 */
struct Ip_sockaddr_ll sll;
} a;
}
Ipmpls_nexthop_info;
/*
*===========================================================================
* Ipmpls_instr_elem
*===========================================================================
*/
struct Ipmpls_nhlfe;
typedef struct Ipmpls_instr_elem
{
Ip_u16 mir_opcode;
Ip_u8 mir_direction;
union {
Ipmpls_label push;
Ipmpls_label fwd;
Ipmpls_nexthop_info set;
Ip_u32 set_rx;
Ip_u32 set_rtab;
} mir_data;
}
Ipmpls_instr_elem;
/*
*===========================================================================
* Ipmpls_instr_req
*===========================================================================
*/
typedef struct Ipmpls_instr_req
{
Ip_u16 mir_family;
Ipmpls_instr_elem mir_instr[IPMPLS_NUM_OPS];
Ip_u8 mir_instr_length;
Ip_u8 mir_direction;
int mir_index;
Ipmpls_label mir_label;
} Ipmpls_instr_req;
/*
*===========================================================================
* Ipmpls_labelspace_req
*===========================================================================
*/
struct Ipmpls_labelspace_req
{
int mls_family;
int mls_ifindex;
int mls_labelspace;
};
/*
*===========================================================================
* Ipmpls_out_label_req
*===========================================================================
*/
struct Ipmpls_out_label_req
{
Ip_u16 mol_family;
Ip_u32 mol_age;
Ipmpls_label mol_label;
Ip_u32 mol_mtu;
Ip_u8 mol_propagate_ttl;
};
/*
*===========================================================================
* Ipmpls_label_req
*===========================================================================
*/
struct Ipmpls_in_label_req
{
Ip_u16 mil_family;
Ip_u32 mil_age;
Ip_u32 mil_proto;
Ipmpls_label mil_label;
};
/*
*===========================================================================
* Ipmpls_xconnect_req
*===========================================================================
*/
struct Ipmpls_xconnect_req
{
Ip_u16 mx_family;
Ipmpls_label mx_in;
Ipmpls_label mx_out;
};
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
IP_PUBLIC int ipmpls_create(void);
IP_PUBLIC Ip_err ipmpls_start(void);
IP_PUBLIC const char* ipmpls_version(void);
IP_PUBLIC Ip_err ipmpls_configure(void);
IP_PUBLIC int ipmpls_ioctl(unsigned long request, void *data);
IP_PUBLIC int ipmpls_input(Ipcom_netif *netif, Ipcom_pkt *pkt, Ip_bool peeked);
#ifdef IPCOM_USE_INET
IP_PUBLIC int ipmpls_ip4_output(Ipcom_netif *netif, Ipcom_pkt *pkt);
#endif
#ifdef IPCOM_USE_INET6
IP_PUBLIC int ipmpls_ip6_output(Ipcom_netif *netif, Ipcom_pkt *pkt);
#endif
#ifdef IP_PORT_LKM
IP_PUBLIC int ipmpls_route_proc_info(char *buffer, char **start,
Ip_u32 offset, int length,
Ip_bool is_ilm);
#endif /* IP_PORT_LKM */
IP_PUBLIC void ipmpls_route_table_notify(Ip_u16 vr, Ip_bool is_added);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/