NetSim Source Code Help
Loading...
Searching...
No Matches
LTENR_Buffer.h
Go to the documentation of this file.
1#pragma once
2/************************************************************************************
3 * Copyright (C) 2020
4 * TETCOS, Bangalore. India *
5
6 * Tetcos owns the intellectual property rights in the Product and its content. *
7 * The copying, redistribution, reselling or publication of any or all of the *
8 * Product or its content without express prior written consent of Tetcos is *
9 * prohibited. Ownership and / or any other right relating to the software and all *
10 * intellectual property rights therein shall remain at all times with Tetcos. *
11 * Author: Shashi Kant Suman *
12 * ---------------------------------------------------------------------------------*/
13#ifndef _NETSIM_LTENR_BUFFER_H_
14#define _NETSIM_LTENR_BUFFER_H_
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#pragma region MACROS
22#define INFINITE_BUFFER 0xFFFFFFFFFFFFFFFF
23#pragma endregion
24
25#pragma region LTENR_BufferPacket
27 {
30 double time;
32
36#pragma endregion
37
38#pragma region LTENR_BUFFER_AND_MACROS
39 typedef struct stru_LTENR_BUFFER
40 {
45
46 void* iterator;
48
49#define LTENR_BUFFER_ISEMPTY(buffer) (buffer != NULL && buffer->headPacket == NULL)
50#define LTENR_BUFFER_HASPACKET(buffer) (buffer != NULL && buffer->headPacket != NULL)
51#pragma endregion
52
53#pragma region FUN_DEF
54 //Function prototype
57
59 NetSim_PACKET* packet,
60 UINT64 size,
61 double time,
62 void* optional);
64 NetSim_PACKET* packet,
65 UINT64 size,
66 double time,
67 void* optional,
68 bool(*fnSort)(ptrLTENR_BUFFEREDPACKET currBuffered,
69 ptrLTENR_BUFFEREDPACKET newBuffered));
71 UINT64* size /* optional*/,
72 double* time /* optional*/,
73 void** optional /* optional*/);
75 UINT64* size /* optional*/,
76 double* time /* optional*/,
77 void** optional /* optional*/);
78
79 //Buffer Iterator
81#define LTENR_BUFFER_NEWITERATOR(buffer) (_LTENR_BUFFER_NEWITERATOR_((buffer),__LINE__,__FILE__))
82
87#pragma endregion
88
89#ifdef __cplusplus
90}
91#endif // __cplusplus
92#endif //_NETSIM_LTENR_BUFFER_H_
NetSim_PACKET * LTENR_BUFFER_HEADPACKET(ptrLTENR_BUFFER buffer, UINT64 *size, double *time, void **optional)
struct stru_LTENR_BufferPacket * ptrLTENR_BUFFEREDPACKET
NetSim_PACKET * LTENR_BUFFER_ITERATOR_NEXT(ptrLTENR_BUFFERITERATOR it)
bool LTENR_BUFFER_ADDPACKET(ptrLTENR_BUFFER buffer, NetSim_PACKET *packet, UINT64 size, double time, void *optional)
struct stru_LTENR_BufferPacket LTENR_BUFFEREDPACKET
void LTENR_BUFFER_DELETEITERATOR(ptrLTENR_BUFFERITERATOR *it)
ptrLTENR_BUFFERITERATOR _LTENR_BUFFER_NEWITERATOR_(ptrLTENR_BUFFER buffer, int line, char *file)
ptrLTENR_BUFFER LTENR_BUFFER_INIT(UINT64 maxSize)
NetSim_PACKET * LTENR_BUFFER_GETPACKET(ptrLTENR_BUFFER buffer, UINT64 *size, double *time, void **optional)
void * ptrLTENR_BUFFERITERATOR
Definition: LTENR_Buffer.h:21
bool LTENR_BUFFER_ADDPACKET_SORTED(ptrLTENR_BUFFER buffer, NetSim_PACKET *packet, UINT64 size, double time, void *optional, bool(*fnSort)(ptrLTENR_BUFFEREDPACKET currBuffered, ptrLTENR_BUFFEREDPACKET newBuffered))
void LTENR_BUFFER_ITERATOR_REMOVE(ptrLTENR_BUFFERITERATOR it)
struct stru_LTENR_BUFFER * ptrLTENR_BUFFER
void LTENR_BUFFER_DELETE(ptrLTENR_BUFFER buffer)
NetSim_PACKET * LTENR_BUFFER_ITERATOR_CURRENT(ptrLTENR_BUFFERITERATOR it)
struct stru_LTENR_BUFFER LTENR_BUFFER
#define UINT64
Definition: Linux.h:37
ptrLTENR_BUFFEREDPACKET tailPacket
Definition: LTENR_Buffer.h:44
ptrLTENR_BUFFEREDPACKET headPacket
Definition: LTENR_Buffer.h:43
struct stru_LTENR_BufferPacket * next
Definition: LTENR_Buffer.h:34
NetSim_PACKET * packet
Definition: LTENR_Buffer.h:28