/* Copyright 1998 Acorn Computers Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * * BUFLIB.H - Header for buffer chains & queues management library * * 18-12-95 INH Derived from Network.C for NetBIOS-over-IP * */ /* Data chain */ typedef struct mbuf *BUFCHAIN; /* Buffer queue */ typedef struct { BUFCHAIN Head; BUFCHAIN Last; } BUFQUEUE; /* Exported functions ================= */ /* Buffer chain handling */ extern void FreeBuf ( BUFCHAIN pB ); extern void FreeChain ( BUFCHAIN pB ); extern BUFCHAIN AddChain ( BUFCHAIN pRest, void *pData, int datalen ); extern BUFCHAIN AddChainIndirect ( BUFCHAIN pRest, void *pData, int datalen ); extern BUFCHAIN GetData ( BUFCHAIN pB, void *pDest, int datalen ); extern BUFCHAIN AllocBlankChain ( int datalen ); extern int ChainLen ( BUFCHAIN pB ); extern int GetAllData ( BUFCHAIN pB, BYTE *pDest ); struct GBP_in_out { BUFCHAIN pChain; BYTE *pBlock; int BlockLen; }; extern int GetBlockPointer ( struct GBP_in_out *pGBP ); /* Buffer Queue Handling */ extern void QueueFlush ( BUFQUEUE *pQ ); extern void QueueAdd ( BUFQUEUE *pQ, BUFCHAIN pB ); extern BUFCHAIN QueueGet ( BUFQUEUE *pQ ); extern BUFCHAIN QueuePeek ( BUFQUEUE *pQ ); extern BUFCHAIN ConcatChain ( BUFCHAIN first, BUFCHAIN last ); /* Init and startup routines */ extern err_t Buf_Init(void); extern void Buf_Shutdown(void);