/* ****************************************************************************** * INTERPEAK SOURCE FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipha_pktbuf.c,v $ $Revision: 1.9 $ * $Source: /home/interpeak/CVSRoot/ipmipha/config/ipmipha_pktbuf.c,v $ * $Author: jhorteli $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Joel Hortelius ****************************************************************************** */ /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #include "ipmipha_config.h" /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #define IPCOM_USE_CLIB_PROTO #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ipmipha_h.h" #include "ipmipha_pktbuf.h" /* **************************************************************************** * 4 DEFINES **************************************************************************** */ /* **************************************************************************** * 5 TYPES **************************************************************************** */ /* **************************************************************************** * 6 EXTERN PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 7 LOCAL PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 8 DATA **************************************************************************** */ /* **************************************************************************** * 9 STATIC FUNCTIONS **************************************************************************** */ /* **************************************************************************** * 10 GLOBAL FUNCTIONS **************************************************************************** */ /* *=========================================================================== * ipmipha_pktbuf_alloc *=========================================================================== * Description: Allocate a packet buffer * Parameters: * Returns: A newly allocated packet buffer * */ IP_GLOBAL Ipmip_pktbuf_t * ipmipha_pktbuf_alloc(Ipmip4_context_t *ctx, Ipmip_proc_t *proc, Ip_size_t extra) { Ipmipha_pktbuf_t *pbuf = ipcom_calloc(1, sizeof(Ipmipha_pktbuf_t) + extra); IPMIP_UNUSED_PARAMETER(ctx); IPMIP_UNUSED_PARAMETER(proc); /* Return a Ipmipha_pktbuf_t */ if (pbuf) { pbuf->ipmip4.ipmip.pktend = (void *) (pbuf + 1); ipmip_buffer_init(&pbuf->reply_fa); ipmip_buffer_init(&pbuf->reply_mn); return &pbuf->ipmip4.ipmip; } return IP_NULL; } /* *=========================================================================== * ipmipha_pktbuf_free *=========================================================================== * Description: Free a packet buffer * Parameters: pbuf - The packet buffer * Returns: * */ IP_GLOBAL void ipmipha_pktbuf_free(Ipmip4_context_t *ctx, Ipmip_proc_t *proc, Ipmipha_pktbuf_t *pbuf) { IPMIP_UNUSED_PARAMETER(ctx); IPMIP_UNUSED_PARAMETER(proc); /**/ ipmip_buffer_release(&pbuf->reply_fa); ipmip_buffer_release(&pbuf->reply_mn); /* Free the data */ ipcom_free(pbuf); } /* **************************************************************************** * 11 PUBLIC FUNCTIONS **************************************************************************** */ /* **************************************************************************** * END OF FILE **************************************************************************** */