/* ****************************************************************************** * HEADER FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipdhcpc6_sock.h,v $ $Revision: 1.10.38.2 $ * $Source: /home/interpeak/CVSRoot/ipdhcpc6/src/ipdhcpc6_sock.h,v $ * $Author: fguo $ $Date: 2012-08-30 08:55:19 $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Joel Hortelius ****************************************************************************** */ #ifndef IPDHCPC6_SOCK_H #define IPDHCPC6_SOCK_H /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #include "ipdhcpc6_config.h" /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #include "ipdhcpc6_msg.h" #ifdef __cplusplus extern "C" { #endif /* **************************************************************************** * 4 DEFINES **************************************************************************** */ #define IPDHCPC6_MSG_MAX_LEN 1500 /* **************************************************************************** * 5 TYPES **************************************************************************** */ /* **************************************************************************** * 6 FUNCTIONS **************************************************************************** */ /* **************************************************************************** * 5 TYPES **************************************************************************** */ struct Ipdhcpc6_ia; typedef struct Ipdhcpc6_sock_msg { Ip_u8 tid[3]; Ip_u8 __r; Ipdhcpc6_msg_t msg; /* Message we're sending */ struct Ipdhcpc6_ia *ia_head; /* List of IA's referencing this message */ Ipdhcpc6_msg_t *reply; } Ipdhcpc6_sock_msg_t; typedef struct Ipdhcpc6_sock_context { Ip_fd udp_fd[IPCOM_VR_MAX]; /* Send / Receive DHCP messages */ struct Ipdhcpc6_context *context; /* Context (instance) */ char dbuf[IPDHCPC6_MSG_MAX_LEN]; /* DHCPv6 message buffer */ char cbuf[64]; /* Ancillary data */ Ipcom_hash *tid_hash; /* Transaction hash table */ } Ipdhcpc6_sock_context_t; /* **************************************************************************** * 6 FUNCTIONS **************************************************************************** */ /* *=========================================================================== * ipdhcpc6_sock_create *=========================================================================== * Description: Create an sock * Parameters: context - The DHCPC6 socket context. * vr_index - vr index * Returns: NA. * */ IP_GLOBAL void ipdhcpc6_sock_create(Ipdhcpc6_sock_context_t *sctx, int vr_index); /* *=========================================================================== * ipdhcpc6_sock_context_alloc *=========================================================================== * Description: Allocate an sock context * Parameters: context - The DHCPC6 context. * Returns: An sock context. * */ IP_GLOBAL Ipdhcpc6_sock_context_t *ipdhcpc6_sock_context_alloc(struct Ipdhcpc6_context *context); /* *=========================================================================== * ipdhcpc6_sock_context_free *=========================================================================== * Description: Free an sock context * Parameters: rtctxp - Pointer to the DHCPC6 sock context. * Returns: * */ IP_GLOBAL void ipdhcpc6_sock_context_free(Ipdhcpc6_sock_context_t **sctxp); /* *=========================================================================== * ipdhcpc6_sock_context_fdset_init *=========================================================================== * Description: Initialize all file descriptors of this context * Parameters: sctx - sock context * rset - Read set to initialize. * mfd - Maximum file descriptor. * Returns: * */ IP_GLOBAL void ipdhcpc6_sock_context_fdset_init(Ipdhcpc6_sock_context_t *sctx, Ip_fd_set *rset, int *mfd); /* *=========================================================================== * ipdhcpc6_sock_context_fdset_process *=========================================================================== * Description: Process all file descriptors of this context * Parameters: sctx - sock context * rset - Read set to initialize. * status - Incoming status * Returns: Outgoing status * */ IP_GLOBAL int ipdhcpc6_sock_context_fdset_process(Ipdhcpc6_sock_context_t *sctx, Ip_fd_set *rset, int status); /* *=========================================================================== * ipdhcpc6_sock_send *=========================================================================== * Description: Send a packet over the socket * Parameters: sctx - sock context * dst - Destination * dst_mul - Multicast Destination * llocal - Link local. * ifindex - Interface index. * buffer - Buffer pointer * size - Size of buffer * elapsed_time - elapsed time, in hundredths of seconds, since * first message was sent in this transaction * Returns: IP_TRUE on success. * */ IP_GLOBAL Ip_bool ipdhcpc6_sock_send(Ipdhcpc6_sock_context_t *sctx, const struct Ip_in6_addr *dst, const struct Ip_in6_addr *dst_mul, const struct Ip_in6_addr *llocal, struct Ipdhcpc6_if *ifp, void *buffer, Ip_size_t size, Ip_u16 elapsed_time); #ifdef __cplusplus } #endif #endif /* **************************************************************************** * END OF FILE **************************************************************************** */