original files of m241

This commit is contained in:
neelimap
2026-07-30 11:19:44 +05:30
parent 170c2b3f3a
commit afc7070c1f
12254 changed files with 7655111 additions and 0 deletions
@@ -0,0 +1,343 @@
/* IPNET socket ioctl header file */
/*
* Copyright (c) 2006-2008, 2015 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement. No license to Wind River intellectual property rights
* is granted herein. All rights not licensed by Wind River are reserved
* by Wind River.
*/
/*
modification history
--------------------
11nov15,dlk Added SIOCSNDASYNC.
14may08,brg SIFBRDADDR ioctl added for ipvxcompat
17sep07,rme Added SIOCBEATTY to support socket as TTY
20aug07,kch Added SIOCGIFCAP support (WIND00102912).
12jul07,kch Added SIOCSETVLANPRI ioctl mapping.
12dec06,kch Added SIOCXPROMISC and corrected some inline comments.
30nov06,kch Created.
*/
#ifndef __INCipioctlh
#define __INCipioctlh
#ifdef __cplusplus
extern "C" {
#endif
/* IOCTL types: */
#define VX_IOC_VOID 0x20000000
#define VX_IOC_OUT 0x40000000
#define VX_IOC_IN 0x80000000
#define VX_IOC_INOUT (VX_IOC_IN | VX_IOC_OUT)
#define VX_IOC_READ(a) (((0x40 << 24) & (a)) == VX_IOC_OUT)
#define VX_IOC_WRITE(a) (((0x80 << 24) & (a)) == VX_IOC_IN)
#define VX_IOC_RW(a) (((0xc0 << 24) & (a)) == VX_IOC_INOUT)
/* IOCTL size: */
#define VX_IOCPARM_MASK 0x1fff /* Parameter length 13 bits */
#define VX_IOCPARM_LEN(r) (VX_IOCPARM_MASK & ((r) >> 16))
/* IOCTL flags. */
#define VX_IOCF_R 0x00000000 /* read. */
#define VX_IOCF_W 0x00001000 /* write bit. */
/* IOCTL groups: */
#define VX_IOC_GROUP(c) (((c) & 0x00000f00) >> 8)
#define VX_IOCG_BASE 1
#define VX_IOCG_SOCK 2
#define VX_IOCG_NETIF 3
#define VX_IOCG_ARP 4
#define VX_IOCG_INET 5
#define VX_IOCG_INET6 6
#define VX_IOCG_ETH 7
#define VX_IOCG_PPP 8
#define VX_IOCG_WLAN 9
#define VX_IOCG_MCAST 10
#define VX_IOCG_MCAST_IN6 11
#define VX_IOCG_MPLS 12
#define VX_IOCG_RTAB 13
#define VX_IOCG_DS 14
#define VX_IOCG_POLICY_RT 15
#define VX_IOX(g,i,f,t) (((sizeof(t) & VX_IOCPARM_MASK) << 16) | (VX_IOCF_ ## f) | ((VX_IOCG_ ## g) << 8) | (i & 0xff))
#define VX_IO(g,i,f,t) (VX_IOC_VOID | /* no parameter */ \
(((sizeof(t) & VX_IOCPARM_MASK) << 16) | (VX_IOCF_ ## f) | ((VX_IOCG_ ## g) << 8) | (i & 0xff)))
#define VX_IOR(g,i,f,t) (VX_IOC_OUT | /* out-parameter */ \
(((sizeof(t) & VX_IOCPARM_MASK) << 16) | (VX_IOCF_ ## f) | ((VX_IOCG_ ## g) << 8) | (i & 0xff)))
#define VX_IOW(g,i,f,t) (VX_IOC_IN | /* in-parameter */ \
(((sizeof(t) & VX_IOCPARM_MASK) << 16) | (VX_IOCF_ ## f) | ((VX_IOCG_ ## g) << 8) | (i & 0xff)))
#define VX_IOWR(g,i,f,t) (VX_IOC_INOUT | /* in- and out-parameter */ \
(((sizeof(t) & VX_IOCPARM_MASK) << 16) | (VX_IOCF_ ## f) | ((VX_IOCG_ ## g) << 8) | (i & 0xff)))
/* SOCK ioctls (others elsewhere, e.g. sys/ioctl.h): */
#define SIOCSNDASYNC VX_IOW(SOCK, 15, W, int)
/* AF_INET ioctls: */
/* Get interface primary address. */
#define SIOCGIFADDR VX_IOWR(INET, 1, R, struct ifreq)
/* Set interface primary address. */
#define SIOCSIFADDR VX_IOWR(INET, 2, W, struct ifreq)
/* Get broadcast address. */
#define SIOCGIFBRDADDR VX_IOWR(INET, 3, R, struct ifreq)
/* Set broadcast address. */
#define SIOCSIFBRDADDR VX_IOWR(INET, 4, W, struct ifreq)
/* Get (sub)net address mask. */
#define SIOCGIFNETMASK VX_IOWR(INET, 5, R, struct ifreq)
/* Set (sub)net address mask. */
#define SIOCSIFNETMASK VX_IOWR(INET, 6, W, struct ifreq)
/* Get point-to-point IPv4 address. */
#define SIOCGIFDSTADDR VX_IOWR(INET, 7, R, struct ifreq)
/* Set point-to-point IPv4 address. */
#define SIOCSIFDSTADDR VX_IOWR(INET, 8, W, struct ifreq)
/* Add interface alias/address. */
#define SIOCAIFADDR VX_IOWR(INET, 9, W, struct in_aliasreq)
/* Delete interface address. */
#define SIOCDIFADDR VX_IOWR(INET, 10, W, struct ifreq)
/* Deprecated (BSD 4.3 compat): add route. */
#define SIOCADDRT VX_IOWR(INET, 11, W, struct ortentry)
/* Deprecated (BSD 4.3 compat): remove route. */
#define SIOCDELRT VX_IOWR(INET, 12, W, struct ortentry)
/* Proprietary (BSD 4.3 compat): get route. */
#define SIOCXGETRT VX_IOWR(INET, 13, R, struct ortentry)
/* Proprietary AF_INET MIP ioctls */
/* Add a home address */
#define SIOCAHOMEADDR VX_IOWR(INET, 14, W, struct in_aliasreq)
/* AF_INET6 ioctls: */
#ifdef INET6
/* Add interface IPv6 address */
#define SIOCAIFADDR_IN6 VX_IOWR(INET6, 1, W, struct in6_aliasreq)
/* Delete interface IPv6 address. */
#define SIOCDIFADDR_IN6 VX_IOWR(INET6, 2, W, struct in6_ifreq)
/* Get destination IPv6 address. */
#define SIOCGIFDSTADDR_IN6 VX_IOWR(INET6, 3, R, struct in6_ifreq)
/* proprietary AF_INET6 MIP6 ioctl */
#define SIOCMIP6 VX_IOWR(INET6, 4, W, struct mip6) /* MIP6 */
/* Get interface IPv6 address prefix */
#define SIOCGIFPREFIX_IN6 VX_IOWR(INET6, 5, R, struct in6_ifreq)
/* Get interface IPv6 address */
#define SIOCXGIFADDR_IN6 VX_IOWR(INET6, 6, W, struct in6_aliasreq)
/* Get inerface IPv6 address prefix */
#define SIOCGIFPREFIX_IN6 VX_IOWR(INET6, 5, R, struct in6_ifreq)
#endif /* INET6 */
/* ARP ioctls: */
/* Create/modify ARP entry. */
#define SIOCSARP VX_IOWR(ARP, 1, W, struct arpreq)
/* Get ARP entry. */
#define SIOCGARP VX_IOWR(ARP, 2, R, struct arpreq)
/* Delete ARP entry */
#define SIOCDARP VX_IOWR(ARP, 3, W, struct arpreq)
/* interface ioctls: */
/* Get interface flags. */
#define SIOCGIFFLAGS VX_IOWR(NETIF, 1, R, struct ifreq)
/* Set interface flags. */
#define SIOCSIFFLAGS VX_IOWR(NETIF, 2, W, struct ifreq)
/* Get interface MTU. */
#define SIOCGIFMTU VX_IOWR(NETIF, 3, R, struct ifreq)
/* Set interface MTU. */
#define SIOCSIFMTU VX_IOWR(NETIF, 4, W, struct ifreq)
/* Get link level address. */
#define SIOCGIFLLADDR VX_IOWR(NETIF, 13, R, struct ifreq)
/* Set link level address. */
#define SIOCSIFLLADDR VX_IOWR(NETIF, 14, W, struct ifreq)
/* Get interface list. */
#define SIOCGIFCONF VX_IOWR(NETIF, 21, R, struct ifconf)
/* Get interface index */
#define SIOCGIFINDEX VX_IOWR(NETIF, 22, R, struct ifreq)
/* Get interface capabilities */
#define SIOCGIFCAP VX_IOWR(NETIF, 23, R, struct ifreq)
/* Get interface name */
#define SIOCGIFNAME VX_IOWR(NETIF, 24, R, struct ifreq)
/* Get TX queue length */
#define SIOCGIFTXQLEN VX_IOWR(NETIF, 25, R, struct ifreq)
/* Set TX queue length */
#define SIOCSIFTXQLEN VX_IOWR(NETIF, 26, R, struct ifreq)
/* Set interface name */
#define SIOCSIFNAME VX_IOWR(NETIF, 27, R, struct ifreq)
/* Set HW broadcast */
#define SIOCSIFHWBROADCAST VX_IOWR(NETIF, 28, R, struct ifreq)
/* Add multicast address */
#define SIOCADDMULTI VX_IOWR(NETIF, 29, W, struct sockaddr)
/* Delete multicast address */
#define SIOCDELMULTI VX_IOWR(NETIF, 30, W, struct sockaddr)
/* Set interface hardware address */
#define SIOCGIFHWADDR VX_IOWR(NETIF, 31, R, struct ifreq)
/* proprietary ioctls: */
/* Detach interface. */
#define SIOCXDETACH VX_IOWR(NETIF, 50, W, struct ifreq)
/* Attach interface. */
#define SIOCXATTACH VX_IOWR(NETIF, 51, W, struct ifreq)
/* Get DHCP status. */
#define SIOCXGDHCPRUNNING VX_IOWR(NETIF, 52, R, struct ifreq)
/* Enable(1)/Disable(0) DHCP. */
#define SIOCXSDHCPRUNNING VX_IOWR(NETIF, 53, W, struct ifreq)
/* Get private interface data */
#define SIOCGIFPRIVATE VX_IOWR(NETIF, 54, R, struct ifreq)
/* Set private interface data */
#define SIOCSIFPRIVATE VX_IOWR(NETIF, 55, W, struct ifreq)
/* Set interface callback. */
#define SIOCXSIFFEVENTCB VX_IOW(BASE, 74, W, if_eventcb)
/* Delete interface callback. */
#define SIOCXDIFFEVENTCB VX_IOW(BASE, 75, W, if_eventcb)
/* Pretend to be a TTY. */
#define SIOCBEATTY VX_IOW(BASE, 76, W, int)
#ifdef INET6
/* Proprietary : get IPv6 gateway. */
#define SIOCXGETGW_IN6 VX_IOWR(BASE, 53, R, struct sockaddr_in6)
/* Proprietaty : set IPv6 gateway. */
#define SIOCXSETGW_IN6 VX_IOWR(BASE, 54, W, struct sockaddr_in6)
#endif /* INET6 */
/* IPSEC ioctls */
#define SIOCXIPSEC_CTL VX_IOWR(BASE, 55, W, void *)
#define SIOCXIPSEC_SA_CTL VX_IOWR(BASE, 56, W, void *[2])
#define SIOCXIPSEC_CONF_CTL VX_IOWR(BASE, 57, W, void *)
/* Multicast ioctls: */
/* get VIF statistics */
#define SIOCGETVIFCNT VX_IOWR(MCAST, 0, R, struct sioc_vif_req)
/* get mcast route statistics */
#define SIOCGETSGCNT VX_IOWR(MCAST, 1, R, struct sioc_sg_req)
#ifdef INET6
/* AF_INET6 multicast ioctls: */
/* get MIF statistics */
#define SIOCGETMIFCNT_IN6 VX_IOWR(MCAST_IN6, 0, R, struct sioc_mif_req6)
/* get mcast6 route statistics */
#define SIOCGETSGCNT_IN6 VX_IOWR(MCAST_IN6, 1, R, struct sioc_sg_req6)
#endif /* INET6 */
/* route table ioctls */
/* Add a new virtual router and creates a route table with table ID == 0 */
#define SIOCADDVR VX_IOWR(RTAB, 0, W, u_int16_t)
/* Delete a virtual router and all tables owned by it */
#define SIOCDELVR VX_IOWR(RTAB, 1, W, u_int16_t)
/* Add a route table to a (virtual) router */
#define SIOCADDROUTETAB VX_IOWR(RTAB, 2, W, struct sioc_route_table)
/* Delete a route table to a (virtual) router */
#define SIOCDELROUTETAB VX_IOWR(RTAB, 3, W, struct sioc_route_table)
/* Get/create a route table by name */
#define SIOCGETROUTETAB VX_IOWR(RTAB, 4, W, struct sioc_route_table)
/* Set a name for a route table. */
#define SIOCSROUTETABNAME VX_IOWR(RTAB, 5, W, struct sioc_route_table)
/* Map a route table name to VR and table ID */
#define SIOCGROUTETABNAME VX_IOWR(RTAB, 6, R, struct sioc_route_table)
/* interface ioctls: */
/* Get interface metric. */
#define SIOCGIFMETRIC VX_IOWR(NETIF, 5, R, struct ifreq)
/* Set interface metric. */
#define SIOCSIFMETRIC VX_IOWR(NETIF, 6, W, struct ifreq)
/* Get the route table index for an interface. */
#define SIOCGIFVR VX_IOWR(NETIF, 7, R, struct ifreq)
/* Set an interface to a specific route table. */
#define SIOCSIFVR VX_IOWR(NETIF, 8, W, struct ifreq)
/* Get tunnel parameter. */
#define SIOCGETTUNNEL VX_IOWR(NETIF, 10, R, struct ip_tunnel_param)
/* Change tunnel parameters. */
#define SIOCCHGTUNNEL VX_IOWR(NETIF, 12, W, struct ip_tunnel_param)
/* Get information about a virtual LAN interface,
* 'ifru_data' must point to a struct vlanreq
*/
#define SIOCGETVLAN VX_IOWR(NETIF, 15, R, struct ifreq)
/* Set information about a virtual LAN interface,
* 'ifru_data' must point to a struct vlanreq
*/
#define SIOCSETVLAN VX_IOWR(NETIF, 16, W, struct ifreq)
/* Create a pseudo interface (like vlan) */
#define SIOCIFCREATE VX_IOWR(NETIF, 17, W, struct ifreq)
/* Destroy a pseudo interface (like vlan) */
#define SIOCIFDESTROY VX_IOWR(NETIF, 18, W, struct ifreq)
/* Set vlan priority for a virtual LAN interface */
#define SIOCSETVLANPRI VX_IOWR(NETIF, 19, W, struct ifreq)
/* bool: Activate/deactivate promiscuous mode. 'bool'is stored in int. */
#define SIOCXPROMISC VX_IOW(NETIF, 102, W, int)
/* proprietary ioctls: */
/* Reset interface statistics counter */
#define SIOCXRESETSTAT VX_IOWR(NETIF, 60, W, struct ifreq)
#ifdef __cplusplus
}
#endif
#endif /* __INCipioctlh */
@@ -0,0 +1,122 @@
/* ipioctl_var.h - IP ioctl variable header file */
/*
* Copyright (c) 2007 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement. No license to Wind River intellectual property rights
* is granted herein. All rights not licensed by Wind River are reserved
* by Wind River.
*/
/*
modification history
--------------------
01c,12jul07,kch Moved sioc_vif_req and sioc_sg_req struct to ip_mroute.h.
Also moved sioc_sg_req6 and sioc_mif_req6 struct to
ip6_mroute.h (WIND00102340).
01b,24apr07,tkf Add IPv6-Only build support.
01a,30nov06,kch Created.
*/
#ifndef __INCipioctl_varh
#define __INCipioctl_varh
/* includes */
#include <net/if.h>
#ifdef INET
#include <netinet/in.h>
#endif
#ifdef INET6
#include <netinet6/in6.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef int (*if_eventcb)(char *ifname, u_int32_t ifindex, u_int32_t ifflags,
int event, void *data);
/* The maximum length of route table name */
#define RTNAMSIZ 16
/* This VR ID tells the stack to choose an unused ID and also choose the
default route table ID */
#define VR_ANY 0xffff
/* This table ID tells the stack to choose an unused ID on the specified VR */
#define ROUTE_TABLE_ANY 0xffffffff
/*
* Structure used by SIOCADDROUTETAB, SIOCDELROUTETAB, SIOCGETROUTETAB,
* SIOCSROUTETABNAME and SIOCGROUTETABNAME for manipulating route tables
* for an existing (virtual) router.
*/
struct sioc_route_table {
/* (Virtual) router index, 0 == default, VR_ANY can be used to let the
* stack choose a virtual router ID
*/
u_int16_t vr;
/* The ID of this table. Table 0 is always present and cannot be deleted.
* Setting table to ROUTE_TABLE_ANY in an add operation will result in
* the stack choosing a free ID
*/
u_int32_t table;
char name[RTNAMSIZ]; /* The (optional) name of the route table */
};
union sockaddr_union
{
struct sockaddr sa;
#ifdef INET
struct sockaddr_in sin;
#endif /* INET */
#ifdef INET6
struct sockaddr_in6 sin6;
#endif /* INET6 */
};
/*
* Tunnel parameter struct used with SIOCGETTUNNEL and SIOCCHGTUNNEL ioctls.
*/
struct ip_tunnel_param
{
char ifr_name[IFNAMSIZ]; /* if name, e.g. "gif1", "gre1" */
/* The address to use as source address for outgoing packets, must
* be the address of a local interface
*/
union sockaddr_union local_addr;
/* The address to use as destination address for outgoing packets */
union sockaddr_union remote_addr;
u_int8_t ttl; /* Value to put in time to live field */
/* These fields are read only (returned by IP_SIOCGETTUNNEL) */
/* Tunnel protocol: IP_IPPROTO_IPIP or IP_IPPROTO_GRE. */
u_int8_t protocol;
u_int16_t o_flags; /* Output flags (tunnel protocol specific). */
u_int16_t i_flags; /* Input flags (tunnel protocol specific). */
};
#ifdef INET6
/*
* used when communicating with the MIP6 subsystem
*/
struct mip6
{
u_int32_t pad[40]; /* Large enough to deal with the MIP stuff */
};
#endif /* INET6 */
#ifdef __cplusplus
}
#endif
#endif /* __INCipioctl_varh */
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,386 @@
/* pfkeyv2.h - Extended PF_KEY version 2 header file */
/*
* This file defines structures and symbols for the PF_KEY Version 2
* key management interface. It was written at the U.S. Naval Research
* Laboratory. This file is in the public domain. The authors ask that
* you leave this credit intact on any copies of this file.
*/
/* Copyright 2006 Wind River Systems, Inc. */
/*
modification history
--------------------
*/
#ifndef __PFKEY_V2_H
#define __PFKEY_V2_H 1
/* includes */
#include "sys/types.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* version
*/
#define PF_KEY_V2 2
#define PFKEYV2_REVISION 199806L
/*
* SA types
*/
#define SADB_SATYPE_UNSPEC 0
#define SADB_SATYPE_AH 2
#define SADB_SATYPE_ESP 3
#define SADB_SATYPE_RSVP 5
#define SADB_SATYPE_OSPFV2 6
#define SADB_SATYPE_RIPV2 7
#define SADB_SATYPE_MIP 8
#define SADB_X_SATYPE_IPIP 9
#define SADB_X_SATYPE_TCPSIGNATURE 10
#define SADB_X_SATYPE_BYPASS 11
#define SADB_SATYPE_MAX 11
/*
* SA extensions - SADB_EXT_
*/
#define SADB_EXT_RESERVED 0 /* _Extension_data_type_ */
#define SADB_EXT_SA 1 /* struct sadb_sa */
#define SADB_EXT_LIFETIME_CURRENT 2 /* struct sadb_lifetime */
#define SADB_EXT_LIFETIME_HARD 3 /* struct sadb_lifetime */
#define SADB_EXT_LIFETIME_SOFT 4 /* struct sadb_lifetime */
#define SADB_EXT_ADDRESS_SRC 5 /* struct sadb_address */
#define SADB_EXT_ADDRESS_DST 6 /* struct sadb_address */
#define SADB_EXT_ADDRESS_PROXY 7 /* struct sadb_address */
#define SADB_EXT_KEY_AUTH 8 /* struct sadb_key */
#define SADB_EXT_KEY_ENCRYPT 9 /* struct sadb_key */
#define SADB_EXT_IDENTITY_SRC 10 /* struct sadb_ident */
#define SADB_EXT_IDENTITY_DST 11 /* struct sadb_ident */
#define SADB_EXT_SENSITIVITY 12 /* struct sadb_sens */
#define SADB_EXT_PROPOSAL 13 /* struct sadb_prop */
#define SADB_EXT_SUPPORTED 14 /* struct sadb_supported */
#define SADB_EXT_SPIRANGE 15 /* struct sadb_spirange */
#define SADB_X_EXT_SRC_MASK 16 /* struct sadb_address */
#define SADB_X_EXT_DST_MASK 17 /* struct sadb_address */
#define SADB_X_EXT_PROTOCOL 18 /* struct sadb_protocol */
#define SADB_X_EXT_SA2 19 /* struct sadb_sa */
#define SADB_X_EXT_SRC_FLOW 20 /* struct sadb_address */
#define SADB_X_EXT_DST_FLOW 21 /* struct sadb_address */
#define SADB_X_EXT_DST2 22 /* struct sadb_address */
#define SADB_X_EXT_FLOW_TYPE 23 /* struct sadb_protocol */
#define SADB_X_EXT_UDPENCAP 24 /* struct sadb_x_udpencap */
#define SADB_EXT_MAX 24
/* sadb_sa_flags */
#define SADB_SAFLAGS_PFS 0x001L /* perfect forward secrecy */
#define SADB_X_SAFLAGS_HALFIV 0x002L /* Used for ESP-old */
#define SADB_X_SAFLAGS_TUNNEL 0x004L /* Force tunneling */
#define SADB_X_SAFLAGS_CHAINDEL 0x008L /* Delete whole SA chain */
#define SADB_X_SAFLAGS_REPLACEFLOW 0x020L /* Replace existing flow */
#define SADB_X_SAFLAGS_INGRESS_FLOW 0x040L /* Ingress ACL entry */
#define SADB_X_SAFLAGS_RANDOMPADDING 0x080L /* Random ESP padding */
#define SADB_X_SAFLAGS_NOREPLAY 0x100L /* No replay counter */
#define SADB_X_SAFLAGS_UDPENCAP 0x200L /* ESP in UDP */
/* new sadb_sa_flags by Interpeak: */
#define SADB_X_SAFLAGS_INGRESS_SA 0x040L /* Ingress SA entry (same val as INGRESS_FLOW) */
#define SADB_X_SAFLAGS_EGRESS_SA 0x400L /* Egress (output) SA entry */
/*
* sadb_msg
*/
struct sadb_msg
{
uint8_t sadb_msg_version;
uint8_t sadb_msg_type;
uint8_t sadb_msg_errno;
uint8_t sadb_msg_satype;
uint16_t sadb_msg_len;
uint16_t sadb_msg_reserved;
uint32_t sadb_msg_seq;
uint32_t sadb_msg_pid;
};
/* sadb_msg_type */
#define SADB_RESERVED 0
#define SADB_GETSPI 1
#define SADB_UPDATE 2
#define SADB_ADD 3
#define SADB_DELETE 4
#define SADB_GET 5
#define SADB_ACQUIRE 6
#define SADB_REGISTER 7
#define SADB_EXPIRE 8
#define SADB_FLUSH 9
#define SADB_DUMP 10
#define SADB_X_PROMISC 11
#define SADB_X_ADDFLOW 12
#define SADB_X_DELFLOW 13
#define SADB_X_GRPSPIS 14
#define SADB_X_BINDSA 15
#define SADB_MAX 15
/*
* sadb_ext
*/
struct sadb_ext
{
uint16_t sadb_ext_len;
uint16_t sadb_ext_type;
};
/*
* sadb_sa
*/
struct sadb_sa
{
uint16_t sadb_sa_len;
uint16_t sadb_sa_exttype;
uint32_t sadb_sa_spi;
uint8_t sadb_sa_replay;
uint8_t sadb_sa_state;
uint8_t sadb_sa_auth;
uint8_t sadb_sa_encrypt;
uint32_t sadb_sa_flags;
};
/* sadb_sa_state */
#define SADB_SASTATE_LARVAL 0
#define SADB_SASTATE_MATURE 1
#define SADB_SASTATE_DYING 2
#define SADB_SASTATE_DEAD 3
#define SADB_SASTATE_MAX 3
#define SADB_KEY_FLAGS_MAX 0
/* sadb_sa_auth */
#define SADB_AALG_NONE 0
#define SADB_AALG_MD5HMAC 1
#define SADB_AALG_SHA1HMAC 2
#define SADB_AALG_MD5HMAC96 3
#define SADB_AALG_SHA1HMAC96 4
#define SADB_X_AALG_RIPEMD160HMAC96 5
#define SADB_X_AALG_MD5 6
#define SADB_X_AALG_SHA1 7
#define SADB_X_AALG_AESXCBCMAC96 8
#define SADB_AALG_MAX 8
/* sadb_sa_encrypt */
#define SADB_EALG_NONE 0
#define SADB_EALG_DESCBC 1
#define SADB_EALG_3DESCBC 2
#define SADB_X_EALG_BLF 3
#define SADB_X_EALG_CAST 4
#define SADB_X_EALG_SKIPJACK 5 /* not supported */
#define SADB_X_EALG_AES 6
#define SADB_EALG_MAX 6
/*
* sadb_lifetime
*/
struct sadb_lifetime
{
uint16_t sadb_lifetime_len;
uint16_t sadb_lifetime_exttype;
uint32_t sadb_lifetime_allocations;
uint64_t sadb_lifetime_bytes;
uint64_t sadb_lifetime_addtime;
uint64_t sadb_lifetime_usetime;
};
/*
* sadb_address
*/
struct sadb_address
{
uint16_t sadb_address_len;
uint16_t sadb_address_exttype;
uint8_t sadb_address_proto;
uint8_t sadb_address_prefixlen;
uint16_t sadb_address_reserved;
};
/*
* sadb_key
*/
struct sadb_key
{
uint16_t sadb_key_len;
uint16_t sadb_key_exttype;
uint16_t sadb_key_bits;
uint16_t sadb_key_reserved;
};
/*
* sadb_ident
*/
struct sadb_ident
{
uint16_t sadb_ident_len;
uint16_t sadb_ident_exttype;
uint16_t sadb_ident_type;
uint16_t sadb_ident_reserved;
uint64_t sadb_ident_id;
};
/* sadb_ident_type */
#define SADB_IDENTTYPE_RESERVED 0
#define SADB_IDENTTYPE_PREFIX 1
#define SADB_IDENTTYPE_FQDN 2
#define SADB_IDENTTYPE_USERFQDN 3
#define SADB_IDENTTYPE_MAX 3
/*
* sadb_sens
*/
struct sadb_sens
{
uint16_t sadb_sens_len;
uint16_t sadb_sens_exttype;
uint32_t sadb_sens_dpd;
uint8_t sadb_sens_sens_level;
uint8_t sadb_sens_sens_len;
uint8_t sadb_sens_integ_level;
uint8_t sadb_sens_integ_len;
uint32_t sadb_sens_reserved;
};
/*
* sadb_prop
*/
struct sadb_prop
{
uint16_t sadb_prop_len;
uint16_t sadb_prop_exttype;
uint8_t sadb_prop_replay;
uint8_t sadb_prop_reserved[3];
};
/*
* sadb_comb
*/
struct sadb_comb
{
uint8_t sadb_comb_auth;
uint8_t sadb_comb_encrypt;
uint16_t sadb_comb_flags;
uint16_t sadb_comb_auth_minbits;
uint16_t sadb_comb_auth_maxbits;
uint16_t sadb_comb_encrypt_minbits;
uint16_t sadb_comb_encrypt_maxbits;
uint32_t sadb_comb_reserved;
uint32_t sadb_comb_soft_allocations;
uint32_t sadb_comb_hard_allocations;
uint64_t sadb_comb_soft_bytes;
uint64_t sadb_comb_hard_bytes;
uint64_t sadb_comb_soft_addtime;
uint64_t sadb_comb_hard_addtime;
uint64_t sadb_comb_soft_usetime;
uint64_t sadb_comb_hard_usetime;
};
/*
* sadb_suppported
* original sadb_supported struct:
* struct sadb_supported
* {
* uint16_t sadb_supported_len;
* uint16_t sadb_supported_exttype;
* uint32_t sadb_supported_reserved;
* };
*/
struct sadb_supported
{
uint16_t sadb_supported_len;
uint16_t sadb_supported_exttype;
uint8_t sadb_supported_nauth;
uint8_t sadb_supported_nencrypt;
uint16_t sadb_supported_reserved;
};
/*
* sadb_alg
*/
struct sadb_alg
{
uint8_t sadb_alg_id;
uint8_t sadb_alg_ivlen;
uint16_t sadb_alg_minbits;
uint16_t sadb_alg_maxbits;
uint16_t sadb_alg_reserved;
};
/*
* sadb_spirange
*/
struct sadb_spirange
{
uint16_t sadb_spirange_len;
uint16_t sadb_spirange_exttype;
uint32_t sadb_spirange_min;
uint32_t sadb_spirange_max;
uint32_t sadb_spirange_reserved;
};
/*
* sadb_protocol
*/
struct sadb_protocol
{
uint16_t sadb_protocol_len;
uint16_t sadb_protocol_exttype;
uint8_t sadb_protocol_proto;
uint8_t sadb_protocol_reserved1;
uint16_t sadb_protocol_reserved2;
};
/* SADB_X_EXT_FLOW_TYPE sadb_protocol_proto */
#define SADB_X_FLOW_TYPE_USE 1 /* Apply security (standard flow) */
#define SADB_X_FLOW_TYPE_ACQUIRE 2 /* Generate acquire message, send packet in cleartext */
#define SADB_X_FLOW_TYPE_REQUIRE 3 /* Generate acquire message, discard packet */
#define SADB_X_FLOW_TYPE_BYPASS 4 /* Send without applying security, i.e. cleartext */
#define SADB_X_FLOW_TYPE_DENY 5 /* Silent discard */
/*#define SADB_X_FLOW_TYPE_DONTACQ 6*/
/*
* sadb_x_udpencap
*/
struct sadb_x_udpencap
{
uint16_t sadb_x_udpencap_len;
uint16_t sadb_x_udpencap_exttype;
uint16_t sadb_x_udpencap_port;
uint16_t sadb_x_udpencap_reserved;
};
#ifdef __cplusplus
}
#endif
#endif /* !__PFKEY_V2_H */
@@ -0,0 +1,117 @@
/* policy_routing.h - policy routing header file */
/*
* Copyright (c) 2006 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement. No license to Wind River intellectual property rights
* is granted herein. All rights not licensed by Wind River are reserved
* by Wind River.
*/
/*
modification history
--------------------
01a,30nov06,kch Guarded inet6 definitions with INET6. Also replaced IP_IOWR
with VX_IOWR and added ipnet/ipioctl.h include.
*/
#ifndef __INCpolicy_routingh
#define __INCpolicy_routingh
/* includes */
#include <ipnet/ipioctl.h>
#include "netinet/in.h"
#ifdef INET6
#include "netinet6/in6.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Policy routing i/o controls
*/
#define PR_BASE 20
#define SIOCGPRRULE VX_IOWR(POLICY_RT, 0, R, struct policy_routing_rule)
#define SIOCSPRRULE VX_IOWR(POLICY_RT, 1, W, struct policy_routing_rule)
#define SIOCDPRRULE VX_IOWR(POLICY_RT, 2, W, struct policy_routing_rule)
#define SIOCEPRRULE VX_IOWR(POLICY_RT, 3, R, struct policy_routing_rule)
/*
* Rules are processed by descending priority, rules with same priority
* are processed in the order they where added (added first is processed first)
*/
#define PR_PRIO_MIN (-32768)
#define PR_PRIO_MAX (32767)
#define PR_ID_NONE 0
/*
* in_addr_union
*/
#ifndef IN_ADDR_UNION_TYPE
#define IN_ADDR_UNION_TYPE
union in_addr_union
{
struct in_addr in;
#ifdef INET6
struct in6_addr in6;
#endif /* INET6 */
};
#endif /* !IN_ADDR_UNION_TYPE */
/*
* policy_routing_rule
*/
struct policy_routing_rule
{
u_long table; /* The table ID of the routing table to use if this rule matches */
BOOL last; /* Set to TRUE if no other rules should consider if the
routing table with policy ID 'policy' does not give a match */
u_long id; /* Unique identifier of this rule (SIOCSPRRULE set this) */
short prio; /* The index of this rule or one of the PR_IDX_xxx macros */
u_short mask; /* Set PR_RULE_xxx bit for each field that must match */
u_char af; /* Address family for this rule */
u_char ds; /* Traffic class (IPv6) or TOS (IPv4) (== DS field for DiffServ) */
u_char proto; /* Protocol in the IP header */
u_char saddr_prefixlen; /* Source prefixlen, set to 0 for exact match of 'saddr' */
u_char daddr_prefixlen; /* Destination prefixlen, set to 0 for exact match of 'daddr' */
union in_addr_union saddr; /* Source address or source network */
union in_addr_union daddr; /* Destination address or destination network */
u_long flow; /* IPv6 flow ID in host byte order */
u_long ifindex; /* Interface index in host byte order (bound if for sending, incoming if for forwarding) */
u_long scope; /* The scope of the destination */
u_long pkt_mask; /* The mask to apply to the packet */
u_long pkt_result; /* The result when masking the flags */
};
/*
* PR_xx
*/
#define PR_RULE_DS (1 << 0)
#define PR_RULE_PROTO (1 << 1)
#define PR_RULE_SADDR (1 << 2)
#define PR_RULE_FLOW (1 << 3)
#define PR_RULE_IFINDEX (1 << 4)
#define PR_RULE_SCOPE (1 << 5)
#define PR_RULE_DADDR (1 << 7)
#define PR_RULE_PKTFLAGS (1 << 8)
/* Do the route lookup based on the source (not destination)
* address in the matching route table
*/
#define PR_RULE_RTKEYSADDR (1 << 15)
#ifdef __cplusplus
}
#endif
#endif /* !__INCpolicy_routingh */
@@ -0,0 +1,266 @@
/*
* Copyright (c) 2006 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement. No license to Wind River intellectual property rights
* is granted herein. All rights not licensed by Wind River are reserved
* by Wind River.
*/
/*
modification history
--------------------
01a,30nov06,kch Created.
*/
#ifndef __INCppp_varh
#define __INCppp_varh
/* includes */
#include "net/if.h"
#include "ipnet/ipioctl.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* The following must not be changed unless equivalent changes are made to
* IPCOM_AUTH_USERNAME_MAX and IPCOM_AUTH_PASSWORD_MAX as well.
*/
#define PPP_AUTH_USERNAME_MAX 32 /* Max user name length. */
#define PPP_AUTH_PASSWORD_MAX 32 /* Max user password length. */
/*
* IO control commands specific to the PPP protocol.
*/
/* Driver PPP ioctls: */
/* ppp_drvconf; Get PPP driver config (default). */
#define SIOCXPPPGDRVCONF VX_IOWR(PPP, 1, R, struct pppreq)
/* ppp_drvconf; Get PPP driver info (current). */
#define SIOCXPPPGDRVINFO VX_IOWR(PPP, 2, R, struct pppreq)
/* u_int32_t; Set PPP driver baudrate. */
#define SIOCXPPPSDRVBAUDRATE VX_IOWR(PPP, 3, W, struct pppreq)
/* -; Make driver signal up (test ioctl) */
#define SIOCXPPPSDRVUP VX_IOWR(PPP, 4, R, struct pppreq)
/* -; Make driver signal down (test ioctl) */
#define SIOCXPPPSDRVDOWN VX_IOWR(PPP, 5, R, struct pppreq)
/* int; Enable wincompat mode */
#define SIOCXPPPSDRVWINCOMPAT VX_IOWR(PPP, 6, R, struct pppreq)
/* Link layer PPP ioctls: */
/* u_int32_t; Get PPP main flags (see PPP_FLAG_xxx) */
#define SIOCXPPPGFLAGS VX_IOWR(PPP, 10, R, struct pppreq)
/* u_int32_t; Set PPP main flags (in ipcom_netif.h) */
#define SIOCXPPPSFLAGS VX_IOWR(PPP, 11, W, struct pppreq)
/* ppp_conf; Get PPP main config. */
#define SIOCXPPPGCONF VX_IOWR(PPP, 12, R, struct pppreq)
/* ppp_conf; Set PPP main config. */
#define SIOCXPPPSCONF VX_IOWR(PPP, 13, W, struct pppreq)
/* char [AUTH_USERNAME_MAX]; Get local user. */
#define SIOCXPPPGUSER VX_IOWR(PPP, 14, R, struct pppreq)
/* char [AUTH_USERNAME_MAX]; Set local user. */
#define SIOCXPPPSUSER VX_IOWR(PPP, 15, W, struct pppreq)
/* char [PPP_AUTH_PASSWORD_MAX]; Get local password. */
#define SIOCXPPPGPASSWD VX_IOWR(PPP, 16, R, struct pppreq)
/* char [PPP_AUTH_PASSWORD_MAX]; Set local password. */
#define SIOCXPPPSPASSWD VX_IOWR(PPP, 17, W, struct pppreq)
/* char [PPP_AUTH_USERNAME_MAX]; Get peer user. */
#define SIOCXPPPGPEERUSER VX_IOWR(PPP, 18, R, struct pppreq)
/* if_name[IFNAMSIZ]; Set pppoe Ethernet interface */
#define SIOCXPPPSETIF VX_IOWR(PPP, 20, W, struct pppreq)
/* ppp_debuginfo; Get PPP debug info. */
#define SIOCXPPPGDINFO VX_IOWR(PPP, 22, R, struct pppreq)
/*
* PPP flags used with SIOCXPPP[G|S]FLAGS ioctl().
*/
/* Disable Address/Control compression in both directions (snd/rcv). */
#define PPP_FLAG_NOACCOMP 0x00000001
/* Do not send or ack ACCM confreq. */
#define PPP_FLAG_NOACCM 0x00000002
/* Require the peer to authenticate itself before allowing snd/rcv NCP. */
#define PPP_FLAG_AUTH 0x00000004
/* Do not require the peer to authenticate itself, i.e. do not ask for
* authentication.
*/
#define PPP_FLAG_NOAUTH 0x00000008
/* Do not agree to authenticate using PAP. */
#define PPP_FLAG_REFUSE_PAP 0x00000010
/* Do not agree to authenticate using MD5 CHAP. */
#define PPP_FLAG_REFUSE_CHAP 0x00000020
/* Initialization action is called directly after the PPP/PPPoE interface has
* been attached, i.e. directly after ipcom_if_attach() has been called.
* The init action is a good place to configure the interface with static
* interface configuration like LCP, AUTH, IPCP and/or IPV6CP etc.
* Note: The init action has replaced the example action callback function
* in previous releases.
*/
#define PPP_ACTION_INIT 1
/* Called when LCP is starting. Configure LCP here.
*/
#define PPP_ACTION_LCP_STARTING 2
/* Called when IPCP is starting.
* Use this callback to set desired local IPv4 address.
* The default local IP address is 0, which means we want the peer to suggest
* an IP address for us.
*/
#define PPP_ACTION_IPCP_STARTING 3
/* Called when IPV6CP is starting.
* Use this callback to set desired peer IPv6 address.
* The default peer IP address is 0, which means we will refuse to suggest
* an IP address for the peer.
*/
#define PPP_ACTION_IPV6CP_STARTING 4
/* IPv4 / IPv6 up/down actions:
* Enter code which must be run when PPP comes up/down here.
*/
#define PPP_ACTION_IP_UP 5
#define PPP_ACTION_IP_DOWN 6
#define PPP_ACTION_IPV6_UP 7
#define PPP_ACTION_IPV6_DOWN 8
/*
* Called when peer sends IPv6 Identifier Configure-Request.
* See RFC274:p6-8 for details.
* Return -1 if refuse to suggest peer IP identifier, else 0.
* 'data' = pointer to 128-bit IPv6 identifier.
*/
#define PPP_ACTION_PEER_IDENTIFIER 9
/*
* Called when we need to authenticate ourselves (i.e. login) to the peer.
* User code must call ipppp_login() with the same 'data',
* user name and password when ready to login.
*/
#define PPP_ACTION_LOGIN 10
/*
* ioctl structure for SIOCXPPP[G|S]CONF options.
*/
typedef struct ppp_conf_struct
{
u_int16_t restart; /* Retransmission timeout in seconds. Default 3 */
/* Max # ConfNak returned before sending ConfRej. Default 10 */
u_int8_t max_failure;
u_int8_t max_configure; /* Max # ConfReq retransmissions. Default 10 */
u_int8_t max_terminate; /* Max # TermReq retransmissions. Default 2 */
/* Max # auth retransmissions before link terminate. Default 3 */
u_int8_t max_authreq;
u_int8_t pad[2];
} ppp_conf;
/*
* ioctl structure for SIOCXPPPGDRVCONF option.
*/
typedef struct ppp_drvconf_struct
{
u_int32_t drv_flags; /* PPP driver flags. */
u_int32_t baudrate; /* Baudrate. */
u_int32_t rcv_accm; /* Recv asyncmap. Default 0xffffffff */
u_int32_t snd_accm; /* Send asyncmap. Default 0xffffffff */
u_int16_t mru; /* Maximum Receive Unit. Default 1500. */
u_int16_t mtu; /* Maximum Transmit Unit. Default 1500. */
} ppp_drvconf;
/*
* PPP driver flags (drv_flags):
*/
/* No initial/trailing PPP flag (0x7e). */
#define DRVPPP_FLAG_NOFLAG 0x00000001
/* Do not byte-escape output/input packets. */
#define DRVPPP_FLAG_NOESCAPE 0x00000002
/* Do not input-check or add output FCS. */
#define DRVPPP_FLAG_NOFCS 0x00000004
/* Do not snd/rcv addr(0xff) ctrl(0x03). */
#define DRVPPP_FLAG_NOACFC 0x00000008
/*
* ioctl structure for SIOCXPPPGDEBUGINFO option.
*/
typedef struct ppp_debuginfo_struct
{
u_int32_t link_flags; /* See ipnet_netif.h */
u_int32_t pppoe_eth_ifindex;
u_int8_t link_state;
u_int8_t lcp_state;
u_int8_t ipcp_state;
u_int8_t ipv6cp_state;
} ppp_debuginfo;
/*
* Interface request structure used for PPP ioctl's. All interface
* ioctl's must have parameter definitions which begin with ifr_name and
* link_index. The remainder may be option specific.
*/
struct pppreq
{
char pppr_name[IFNAMSIZ]; /* if name, e.g. "ppp0" */
int link_index; /* link_index, currently unused (for MPPP) */
union
{
u_int32_t ppp_flags; /* Get/Set PPP flags. */
ppp_conf pppconf; /* Get/Set PPP protocol configuration. */
char username[PPP_AUTH_USERNAME_MAX];
char password[PPP_AUTH_PASSWORD_MAX];
char if_name[IFNAMSIZ];
ppp_drvconf drvconf; /* Get PPP driver configuration. */
u_int32_t drv_baudrate; /* Set PPP driver baudrate. */
int drv_wincompat; /* Windows compat mode */
ppp_debuginfo debuginfo; /* Get PPP debug info. */
} pppru;
};
#ifdef __cplusplus
}
#endif
#endif /* __INCppp_varh */
@@ -0,0 +1,362 @@
/* qos.h - quality of service header file */
/*
* Copyright (c) 2006 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement. No license to Wind River intellectual property rights
* is granted herein. All rights not licensed by Wind River are reserved
* by Wind River.
*/
/*
modification history
--------------------
01a,30nov06,kch Guarded inet6 definitions with INET6. Also replaced IP_IOWR
with VX_IOWR and added ipnet/ipioctl.h include.
*/
#ifndef __INCqosh
#define __INCqosh
/* includes */
#include <ipnet/ipioctl.h>
#include "net/if.h"
#include "netinet/in.h"
#ifdef INET6
#include "netinet6/in6.h"
#endif /* INET6 */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Quality of service i/o controls
*/
#define IFQ_BASE 192
/* Add a filter for differentiated services meter/marker */
#define SIOCXADSFILTER VX_IOWR(DS, 0, W, struct ds_filter)
/* Delete a filter for differentiated services meter/marker */
#define SIOCXDDSFILTER VX_IOWR(DS, 1, W, struct ds_filter)
/* Create a new differentiated services meter/marker entity */
#define SIOCXDSCREATE VX_IOWR(DS, 2, W, struct ds)
/* Destroys a differentiated services meter/marker entity */
#define SIOCXDSDESTROY VX_IOWR(DS, 3, W, struct ds)
/* Add a filter for differentiated services meter/marker */
#define SIOCXADSMAP VX_IOWR(DS, 4, W, struct ds_map)
/* Delete a filter for differentiated services meter/marker */
#define SIOCXDDSMAP VX_IOWR(DS, 5, W, struct ds_map)
/* Get the queue type for an interface */
#define SIOCGIFQUEUE VX_IOWR(NETIF, (IFQ_BASE + 0), R, struct ifqueue_qos)
/* Set the queue type for an interface */
#define SIOCSIFQUEUE VX_IOWR(NETIF, (IFQ_BASE + 1), W, struct ifqueue_qos)
/* Add a filter to an interface queue */
#define SIOCXAIFQFILTER VX_IOWR(NETIF, (IFQ_BASE + 2), W, struct ifqueue_filter)
/* Delete a filter from an interface queue */
#define SIOCXDIFQFILTER VX_IOWR(NETIF, (IFQ_BASE + 3), W, struct ifqueue_filter)
/*
* in_addr_union
*/
#ifndef IN_ADDR_UNION_TYPE
#define IN_ADDR_UNION_TYPE
union in_addr_union
{
struct in_addr in;
#ifdef INET6
struct in6_addr in6;
#endif /* INET6 */
};
#endif /* !IN_ADDR_UNION_TYPE */
/*
* CLASSIFIER DEFINES
*/
/*
* classifier_rule
*/
struct classifier_rule
{
u_short mask; /* Set CLS_RULE_xxx bit for each field that must match */
u_char ds; /* Traffic class (IPv6) or TOS (IPv4) (== DS field for DiffServ) */
u_char proto; /* Protocol in the IP header */
u_short sport_low; /* Source port for UDP and TCP protocols [low..high] */
u_short sport_high; /* Source port for UDP and TCP protocols */
u_short dport_low; /* Destination port for UDP and TCP protocols [low..high] */
u_short dport_high; /* Destination port for UDP and TCP protocols */
u_char af; /* Address family of the addresses (AF_INET or AF_INET6) */
u_char saddr_prefixlen; /* Source prefixlen, set to 0 for exact match of 'saddr' */
u_char daddr_prefixlen; /* Destination prefixlen, set to 0 for exact match of 'daddr' */
union in_addr_union saddr; /* Source address or source network */
union in_addr_union daddr; /* Destination address or destination network */
};
#define CLS_RULE_DS (1 << 0)
#define CLS_RULE_PROTO (1 << 1)
#define CLS_RULE_SADDR (1 << 2)
#define CLS_RULE_DADDR (1 << 3)
#define CLS_RULE_SPORT (1 << 4)
#define CLS_RULE_DPORT (1 << 5)
/*
* DIFFERENTIATE SERVICES
*/
/*
* Connects a DS rule with a DS meter/marker.
* Each meter/marker can be pointed to by more than one rule
*/
struct ds_map
{
int filter_id; /* The filter ID when running in DiffServ Multi-Field mode.
The value of the DS (i.e. TOS or TCLASS) field when running in
Behavior Aggregate mode */
int ds_id; /* The ID of the Differentiated Services handler to apply for
traffic matching the filter */
};
/*
* Rule to match traffic
*/
struct ds_filter
{
int id; /* Id for this filter. Read only for add operation */
struct classifier_rule rule; /* The rule for this filter */
};
/*
* name="SimpleMarker" - Structure for the simple marker
* Matching traffic will be assigned the specified DS field
* and the specified drop_precedence
*/
struct ds_sm
{
u_char mask; /* DS_SM_xxx bits that determines if what should be done
with matching packets */
u_char ds_value; /* Differentiated Services Field to set (if DS_SM_DS_VAL is set) */
u_char drop_precedence; /* The drop precedence, which has to be one of the
IPCOM_PKT_DROP_PRECEDENCE_xxx constants (if DS_SM_DROP_P is set) */
};
#define DS_SM_DS_VAL ((u_char)(1 << 0))
#define DS_SM_DROP_P ((u_char)(1 << 1))
/*
* name="srTCM" - Structure for the single rate Three Color Marker
*/
struct ds_srtcm
{
u_char mode; /* Mode this meter is operating in, one of the
DS_SRTCM_MODE_xxx constants */
u_long CIR; /* Committed Information Rate (bytes/second) */
u_long CBS; /* Committed Burst Size (bytes) */
u_long EBS; /* Excess Burst Size (bytes) */
u_char ds_green; /* Differentiated Services Field to set for green packets */
u_char ds_yellow; /* Differentiated Services Field to set for yellow packets */
u_char ds_red; /* Differentiated Services Field to set for red packets */
};
/* The mode that the srTCM can operate in */
#define DS_SRTCM_MODE_COLOR_BLIND 1
#define DS_SRTCM_MODE_COLOR_AWARE 2
/*
* Differentiated Services ID structure
*/
#define DS_NAME_SIZE 16
struct ds
{
int id; /* ID of the diffserv handler. Read only for create operation */
char name[DS_NAME_SIZE]; /* The name of the diffserv handler */
union ds_data
{
struct ds_sm sm;
struct ds_srtcm srtcm;
} d;
};
/*
* LEAF NETWORK INTERFACE QUEUES
*/
/*
* ifqueue_fifo
* Parameter struct used for "fifo" type queue.
*/
struct ifqueue_fifo
{
u_long fifo_limit; /* Max number of packets that can be queued */
};
/*
* ifqueue_dpaf
* Parameter struct used for the Drop Precedence Aware FIFO queue type.
* This queue type uses more memory and is a little slower compared to the
* FIFO queue.
*/
struct ifqueue_dpaf
{
u_long dpaf_limit; /* Max number of packets (regardless of drop
precedence) that can be queued */
};
/*
* ifqueue_netemu
* Parameter struct used for "netemu" type queue.
*/
struct ifqueue_netemu
{
u_long netemu_limit; /* Max number of packets that can be queued */
u_long netemu_min_latency; /* Minimum latency added to packets in milliseconds */
u_long netemu_max_latency; /* Maximum latency added to packets in milliseconds */
BOOL netemu_random_drop; /* FALSE -> drop every drop_probability packet
TRUE -> there is 1/every drop_probability
chance that at packet is dropped */
u_long netemu_drop_probability; /* 1 means every packet dropped, 10 means that
every 10 packet is dropped */
u_long netemu_drop_pattern; /* Bit patter where set bit means drop packet
ex: Bit 0 and bit 2 set, all other cleared */
u_char netemu_drop_pattern_len; /* Number of valid bits in "netemu_drop_pattern",
setting the length to zero will have the same effect
as setting bit 0 in the pattern and the length to 1 */
BOOL netemu_random_corrupt; /* FALSE -> corrupt every corrupt_probability packet
TRUE -> there is 1/every corrupt_probability
chance that a packet is corrupted */
u_long netemu_corrupt_probability; /* 1 means every packet corrupted, 10 means tha
every 10 packet is corrupted */
};
/*
* CONTAINER NETWORK INTERFACE QUEUES
*/
/*
* ifqueue_filter
* Determines which interface queue a packet will be queued at in the
* container queue identified by the filter ID.
* Diffserv traffic should only use the 'ds' field in the rule, but it is
* possible to use all supported fields.
*/
struct ifqueue_filter
{
char filter_ifname[IFNAMSIZ]; /* Interface name, e.g. "gif1", "gre1" */
int filter_id; /* Will be set to the ID of the filter for add
and is used to identify the filter on delete */
int filter_queue_id; /* The ID of the queue this filter should
be attached to */
/* Following fields are only needed for filter add operations */
int filter_child_queue_id; /* The ID of the child that packet matching
this rule should be queued at */
struct classifier_rule filter_rule;
};
/*
* ifqueue_container
* Read only structure that will be filled in by SIOCGIFQUEUE operation.
*/
#define IFQ_CONTAINER_MAX_COUNT 64
struct ifqueue_container
{
int child_count; /* Number of valid entries in the 'child_ids' array */
int child_ids[IFQ_CONTAINER_MAX_COUNT]; /* ID of the childs */
};
/*
* ifqueue_mbc
* Parameter struct used for "mbc" type queues.
* This container queue type has 2 or more "bands", filter rules determines
* which band is used when enqueueing. The rule for dequeueing works like
* this; packet will be dequeued from band 0 until empty,
* packets will then be dequeued from band 1 until empty, etc.
*/
struct ifqueue_mbc
{
struct ifqueue_container mbc_container; /* Read only */
u_long mbc_bands; /* Number of bands, must be 2 or more */
u_long mbc_default_band; /* Index of the band to use for packets that
do not match any rule [0..prio_bands) */
};
/*
* ifqueue_htbc
* Parameter struct used for "htbc" type queues.
* The default queue will get all traffic that does not match some other
* classify rule.
* Dequeueing is done in by Round-Robin through all childs.
*/
struct ifqueue_htbc
{
struct ifqueue_container htbc_container; /* Read only */
u_long htbc_byterate; /* Maximum bitrate for this queue */
u_long htbc_token_limit; /* Maximum number of tokens this queue
can have, MUST be >MTU of the interface */
int htbc_default_id; /* The ID of the default queue (read-only) */
};
/*
* ifqueue_qos - ioctl
* struct used with SIOCxIFQUEUE ioctls.
*/
struct ifqueue_qos
{
char ifq_name[IFNAMSIZ]; /* if name, e.g. "gif1", "gre1" */
char ifq_type[IFNAMSIZ]; /* queue type e.g. "fifo", "red" */
int ifq_id; /* Must be an ID that unique on the specified interface or
IFQ_ID_NONE for get operation when the root queue should be returned */
int ifq_parent_id; /* ID of the parent queue or IFQ_ID_NONE
if this is directly attached to the interface */
int ifq_count; /* Will contain the current number of queued packets
after a SIOCGIFQUEUE call */
union ifqueue_data
{
struct ifqueue_fifo fifo;
struct ifqueue_dpaf dpaf;
struct ifqueue_netemu netemu;
struct ifqueue_htbc htbc;
struct ifqueue_mbc mbc;
} ifq_data;
};
#define IFQ_ID_NONE 0 /* Must be used as parent ID if the queue is a root queue */
#define IFQ_ID_DEFAULT 1 /* Default ID, should be used on root queues where no specific ID is required */
#ifdef __cplusplus
}
#endif
#endif /* !__INCqosh */