📄 pppframinglayer.c
字号:
/* pppFramingLayer.c - PPP Framing Layer Source File *//* Copyright 1999 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01g,29sep00,sj merging with TOR2_0-WINDNET_PPP-CUM_PATCH_201f,01aug00,adb Merging with openstack view01e,29nov99,sj adding DESCRIPTION for refgen01d,28oct99,sj upgrading to latest version of framework01c,23aug99,sj modified for generic framework01b,12jul99,koz included new framework header files and updated interfaces accordingly01a,07jul99,koz created.*//* includes */#include "stdio.h"#include "stdlib.h"#include "string.h"#include "vxWorks.h"#include "netBufLib.h"#include "net/mbuf.h"#include "pfw/pfw.h"#include "pfw/pfwLayer.h"#include "ppp/pppFramingLayer.h"/*DESCRIPTIONThis module implements the FRAMING_LAYER plug-in object and it resides inthe FRAMING plane.This is a NON_OPERATIONAL layer and in any profile only onecomponent may be configured within this layer.*//* defines *//* typedefs *//* locals *//* forwards */LOCAL STATUS componentAdd (PFW_COMPONENT_OBJ *);LOCAL PFW_PACKET_TYPE packetType (void *);/********************************************************************************* pppFramingLayerCreate - initialize and create the PPP Framing Layer** This routine adds the FRAMING_LAYER plug-in object to the framework** RETURNS: OK or ERROR**/STATUS pppFramingLayerCreate ( PFW_OBJ * pfw /* framework we are adding this to */ ) { PFW_LAYER_OBJ *pFramingLayer; pFramingLayer = (PFW_LAYER_OBJ *) calloc (1, sizeof (PFW_LAYER_OBJ)); if (pFramingLayer == NULL) { pfwPrintError (__FILE__, "pppFramingLayerInit", __LINE__, pfw,0, "Unable to allocate memory"); return (ERROR); } strcpy(pFramingLayer->pluginObj.name, "FRAMING_LAYER"); pFramingLayer->pluginObj.profileDataSize = 0; pFramingLayer->pluginObj.stackDataSize = 0; pFramingLayer->pluginObj.profileDataConstruct = NULL; pFramingLayer->pluginObj.profileDataCopy = NULL; pFramingLayer->pluginObj.profileDataDestruct = NULL; pFramingLayer->pluginObj.stackDataConstruct = NULL; pFramingLayer->pluginObj.stackDataDestruct = NULL; pFramingLayer->pluginObj.pfwObj = pfw; pFramingLayer->planeId = FRAMING_PLANE; pFramingLayer->position = 2; pFramingLayer->type = NON_OPERATIONAL_LAYER; pFramingLayer->componentAdd = componentAdd; pFramingLayer->packetType = packetType; if (pfwLayerAdd (pFramingLayer) == ERROR) { pfwPrintError (__FILE__, "pppFramingLayerInit", __LINE__,pfw, 0, "Framing layer could not be added to the stack"); return (ERROR); } return (OK); }/******************************************************************************** pppFramingLayerDelete - delete the FRAMING_LAYER object from the framework** The FRAMING_LAYER plug-in component object allocated by * pppFramingLayerCreate() is freed if there are no references to this* object from a Stack or Profile object in the framework.** RETURNS: OK or ERROR*/STATUS pppFramingLayerDelete ( PFW_OBJ *pfw ) { PFW_LAYER_OBJ *pFramingLayer; pFramingLayer = (PFW_LAYER_OBJ *)pfwLayerObjGet (pfw, "FRAMING_LAYER"); if (pFramingLayer == NULL) return ERROR; if (pfwLayerDelete (pFramingLayer) == OK) { free (pFramingLayer); return OK; } return (ERROR); }LOCAL STATUS componentAdd ( PFW_COMPONENT_OBJ *co ) { return (OK); } LOCAL PFW_PACKET_TYPE packetType ( void *packet ) { struct mbuf *m = (struct mbuf *)packet; if ((m->m_data[0]&0xff) > 0) return (CONTROL_PACKET); return (DATA_PACKET); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -