283 lines
9.0 KiB
C
283 lines
9.0 KiB
C
/*
|
|
******************************************************************************
|
|
* INTERPEAK API HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmcp_h.h,v $ $Revision: 1.18.10.2 $
|
|
* $Source: /home/interpeak/CVSRoot/ipmcp/src/ipmcp_h.h,v $
|
|
* $Author: svc-cmnet $ $Date: 2013-03-13 07:45:29 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Kenneth Jonsson <kenneth@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef IPMCP_H_H
|
|
#define IPMCP_H_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include "ipmcp_config.h"
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include <ipcom_cstyle.h>
|
|
#include <ipcom_hash.h>
|
|
#include <ipcom_list.h>
|
|
#include <ipcom_os.h>
|
|
#include <ipcom_sock.h>
|
|
#include <ipcom_tmo2.h>
|
|
#include <ipcom_type.h>
|
|
|
|
#ifdef IPMCP_USE_IGMP
|
|
#include "ipmcp_igmp.h"
|
|
#endif
|
|
#ifdef IPMCP_USE_MLD
|
|
#include "ipmcp_mld.h"
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/* IPD name */
|
|
#define IPMCP_IPD_NAME "ipmcp"
|
|
/* Tell the daemon to sleep until the shell command has finished */
|
|
#define IPMCP_IPD_EVENT_WAIT_FOR_SHELL_CMD 100
|
|
|
|
/* Syslog */
|
|
#define IPCOM_SYSLOG_PRIORITY IPMCP_SYSLOG_PRIORITY
|
|
#define IPCOM_SYSLOG_FACILITY IPCOM_LOG_IPMCP
|
|
|
|
|
|
/* Multicast proxy daeomon states */
|
|
#define IPMCP_STATE_HALTED (0) /* daemon halted */
|
|
#define IPMCP_STATE_RUNNING (1) /* daemon running*/
|
|
#define IPMCP_STATE_WAITING (2) /* waiting for the uplink to become avaiable */
|
|
|
|
|
|
/* Per-link state */
|
|
#define IPMCP_LINK_STATE_INACTIVE (0) /* not acting as IGMP/MLD router on this link */
|
|
#define IPMCP_LINK_STATE_NON_QUERIER (1) /* acting as a non-querier */
|
|
#define IPMCP_LINK_STATE_QUERIER (2) /* acting as a querier */
|
|
|
|
/* Link local IP source address availabillity */
|
|
#define IPMCP_LINK_LOCAL_ADR_NOTAVAIL (-1) /* no link local address available */
|
|
#define IPMCP_LINK_LOCAL_ADR_AVAIL (0) /* link local address is available on this link */
|
|
#define IPMCP_LINK_LOCAL_ADR_TENTATIVE (1) /* link local address available, but tentative */
|
|
|
|
/* Multicast address state */
|
|
#define IPMCP_MADDR_STATE_ACTIVE (0) /* Multicast address has listeners */
|
|
#define IPMCP_MADDR_STATE_LAST_LISTENER (1) /* Multicast address in last listener state */
|
|
|
|
/* Address string length for domain unspecific code */
|
|
#ifdef IPMCP_USE_MLD
|
|
#define IPMCP_ADDRSTRLEN IP_INET6_ADDRSTRLEN
|
|
#else
|
|
#define IPMCP_ADDRSTRLEN IP_INET_ADDRSTRLEN
|
|
#endif
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipmcp_netif_t
|
|
*===========================================================================
|
|
* Generic interface data for downstream interface.
|
|
*/
|
|
typedef struct Ipmcp_netif_struct
|
|
{
|
|
Ipcom_list list;
|
|
Ip_u32 ifindex;
|
|
char ifname[IP_IFNAMSIZ];
|
|
#ifdef IPMCP_USE_IGMP
|
|
Ipmcp_igmp_netif_t igmp;
|
|
#endif
|
|
#ifdef IPMCP_USE_MLD
|
|
Ipmcp_mld_netif_t mld;
|
|
#endif
|
|
}
|
|
Ipmcp_netif_t;
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipmcp_upstream_netif_t
|
|
*===========================================================================
|
|
* Upstream interface.
|
|
*/
|
|
typedef struct Ipmcp_upstream_netif_struct
|
|
{
|
|
Ip_u32 ifindex;
|
|
char ifname[IP_IFNAMSIZ];
|
|
#ifdef IPMCP_USE_IGMP
|
|
Ipmcp_igmp_upstream_netif_t igmp;
|
|
#endif
|
|
#ifdef IPMCP_USE_MLD
|
|
Ipmcp_mld_upstream_netif_t mld;
|
|
#endif
|
|
}
|
|
Ipmcp_upstream_netif_t;
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipmcp_conf
|
|
*===========================================================================
|
|
* Cached configuration values.
|
|
*/
|
|
typedef struct Ipmcp_conf_struct
|
|
{
|
|
/* Number of resends of membership queries, should be higher for link
|
|
with high loss probability */
|
|
Ip_u32 robustness_variable;
|
|
/* Time, in milliseconds, between membership query requests beeing sent */
|
|
Ip_u32 query_interval;
|
|
/* Maximum time, in milliseconds, before the host must answer on a
|
|
membership query */
|
|
Ip_u16 query_response_interval;
|
|
/* The Startup Query Interval is the interval between General Queries
|
|
sent by a Querier on startup */
|
|
Ip_u32 startup_query_interval;
|
|
/* The Startup Query Count is the number of Queries sent out on startup,
|
|
separated by the Startup Query Interval.*/
|
|
Ip_u32 startup_query_count;
|
|
/* The Last Member Query Interval is the Max Response Time used to
|
|
calculate the Max Resp Code inserted into Group-Specific Queries sent
|
|
in response to Leave Group messages. It is also the Max Response
|
|
Time used in calculating the Max Resp Code for Group-and-Source-
|
|
Specific Query messages. Default: query_interval / 4 msec */
|
|
Ip_u32 last_member_query_interval;
|
|
/* The Last Member Query Count is the number of Group-Specific Queries
|
|
sent before the router assumes there are no local members. The Last
|
|
Member Query Count is also the number of Group-and-Source-Specific
|
|
Queries sent before the router assumes there are no listeners for a
|
|
particular source. Default: the Robustness Variable.*/
|
|
Ip_u32 last_member_query_count;
|
|
|
|
char *downstream_ifs;
|
|
} Ipmcp_conf_t;
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipmlds_data_t
|
|
*===========================================================================
|
|
* IPMCP global data.
|
|
*/
|
|
typedef struct Ipmcp_data_struct
|
|
{
|
|
Ipcom_sem cmd_sem;
|
|
Ipcom_mutex daemon_mutex;
|
|
|
|
/* One of the IPMCP_STATE_xxx states */
|
|
int state;
|
|
|
|
/* IPD socket */
|
|
Ip_fd ipd_fd;
|
|
/* Route message socket */
|
|
Ip_fd rt_fd;
|
|
|
|
#ifdef IP_PORT_LAS
|
|
/* Config socket */
|
|
Ip_fd cfg_fd;
|
|
#endif
|
|
|
|
/* Timeout queue */
|
|
Ipcom_pqueue *tmo_head;
|
|
|
|
/* Upstream interface, this is the only interface that IPv6 multicast
|
|
traffic can be forwared from */
|
|
Ipmcp_upstream_netif_t upstream_if;
|
|
|
|
/* interface list */
|
|
Ipcom_list downstream_ifs_head;
|
|
|
|
/* cached configuration variables */
|
|
Ipmcp_conf_t config;
|
|
|
|
#ifdef IPMCP_USE_IGMP
|
|
Ipmcp_igmp_data_t igmp;
|
|
#endif
|
|
#ifdef IPMCP_USE_MLD
|
|
Ipmcp_mld_data_t mld;
|
|
#endif
|
|
Ip_u32 send_buf[1500 / sizeof(Ip_u32)];
|
|
Ip_u32 recv_buf[1500/ sizeof(Ip_u32)];
|
|
char log_buf[100];
|
|
} Ipmcp_data_t;
|
|
|
|
|
|
IP_EXTERN Ipmcp_data_t ipmcp;
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
IP_GLOBAL Ipmcp_netif_t * ipmcp_if_find(Ip_u32 ifindex);
|
|
IP_GLOBAL void ipmcp_route_init_addrs(void *msg, Ip_u32 addrs, struct Ip_sockaddr **sas);
|
|
|
|
#ifdef IPMCP_USE_IGMP
|
|
IP_GLOBAL int ipmcp_igmp_init(void);
|
|
IP_GLOBAL void ipmcp_igmp_exit(void);
|
|
IP_GLOBAL int ipmcp_igmp_if_create(Ipmcp_netif_t *netif);
|
|
IP_GLOBAL void ipmcp_igmp_if_destroy(Ipmcp_netif_t *netif);
|
|
IP_GLOBAL int ipmcp_igmp_upstream_if_create(Ipmcp_upstream_netif_t *netif);
|
|
IP_GLOBAL void ipmcp_igmp_upstream_if_destroy(Ipmcp_upstream_netif_t *netif);
|
|
IP_GLOBAL void ipmcp_igmp_addr_change(Ipmcp_netif_t *netif, Ip_bool add);
|
|
IP_GLOBAL int ipmcp_igmp_input(int fd);
|
|
#endif /* IPMCP_USE_IGMP */
|
|
|
|
#ifdef IPMCP_USE_MLD
|
|
IP_GLOBAL int ipmcp_mld_init(void);
|
|
IP_GLOBAL void ipmcp_mld_exit(void);
|
|
IP_GLOBAL int ipmcp_mld_if_create(Ipmcp_netif_t *netif);
|
|
IP_GLOBAL void ipmcp_mld_if_destroy(Ipmcp_netif_t *netif);
|
|
IP_GLOBAL int ipmcp_mld_upstream_if_create(Ipmcp_upstream_netif_t *netif);
|
|
IP_GLOBAL void ipmcp_mld_upstream_if_destroy(Ipmcp_upstream_netif_t *netif);
|
|
IP_GLOBAL void ipmcp_mld_addr_change(Ipmcp_netif_t *netif, Ip_bool add);
|
|
IP_GLOBAL int ipmcp_mld_input(int fd);
|
|
IP_GLOBAL int ipmcp_mld_mroute_input(int fd);
|
|
IP_GLOBAL void ipmcp_mld_show_joined_groups_cb(void *obj, void *unused);
|
|
#endif /* IPMCP_USE_MLD */
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|