/* ****************************************************************************** * INTERPEAK SOURCE FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmippm_pktbuf.c,v $ $Revision: 1.5 $ * $Source: /home/interpeak/CVSRoot/ipmippm/config/ipmippm_pktbuf.c,v $ * $Author: jhorteli $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Joel Hortelius ****************************************************************************** */ /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #include "ipmippm_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 "ipmippm_h.h" #include "ipmippm_pktbuf.h" /* **************************************************************************** * 4 DEFINES **************************************************************************** */ /* **************************************************************************** * 5 TYPES **************************************************************************** */ /* **************************************************************************** * 6 EXTERN PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 7 LOCAL PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 8 DATA **************************************************************************** */ /* **************************************************************************** * 9 STATIC FUNCTIONS **************************************************************************** */ /* **************************************************************************** * 10 GLOBAL FUNCTIONS **************************************************************************** */ /* *=========================================================================== * ipmippm_pktbuf_alloc *=========================================================================== * Description: Allocate a packet buffer * Parameters: * Returns: A newly allocated packet buffer * */ IP_GLOBAL Ipmip_pktbuf_t * ipmippm_pktbuf_alloc(Ipmippm_context_t *ctx, Ipmip_proc_t *proc, Ip_size_t extra) { Ipmippm_pktbuf_t *pbuf = ipcom_calloc(1, sizeof(Ipmippm_pktbuf_t) + extra); IPMIP_UNUSED_PARAMETER(ctx); IPMIP_UNUSED_PARAMETER(proc); if (pbuf) { pbuf->api.ipmip4.ipmip.pktend = (void *) (pbuf + 1); return &pbuf->api.ipmip4.ipmip; } /* Return a Ipmipha_pktbuf_t */ return IP_NULL; } /* *=========================================================================== * ipmippm_pktbuf_free *=========================================================================== * Description: Free a packet buffer * Parameters: pbuf - The packet buffer * Returns: * */ IP_GLOBAL void ipmippm_pktbuf_free(Ipmippm_context_t *ctx, Ipmip_proc_t *proc, Ipmippm_pktbuf_t *pbuf) { if (pbuf->trigger.pmTriggerCOA) ipcom_free(pbuf->trigger.pmTriggerCOA); ipmipmn_api_pktbuf_free(&ctx->api, proc, &pbuf->api); /* Free the data */ ipcom_free(pbuf); } /* **************************************************************************** * 11 PUBLIC FUNCTIONS **************************************************************************** */ /* **************************************************************************** * END OF FILE **************************************************************************** */