Click
Loading...
Searching...
No Matches
modificationlist.hh
1#ifndef MIDDLEBOX_MODIFICATIONLIST_HH
2#define MIDDLEBOX_MODIFICATIONLIST_HH
3
4/*
5 * modificationlist.hh - Class used to store the modifications performed in a
6 * packet's structure
7 *
8 * Romain Gaillard.
9 */
10
11#include <click/config.h>
12#include <click/glue.hh>
13#include "memorypool.hh"
14#include "bytestreammaintainer.hh"
15
16CLICK_DECLS
17
19
24{
25 uint32_t position;
26 int offset;
29};
30
41{
42 // TCPOut is the only component allowed to commit modifications
43 // It is thus a friend which can access the private method "commit"
44 friend class TCPOut;
45
46public:
52
56
60 void printList();
61
71 bool addModification(uint32_t firstPosition, uint32_t position, int offset);
72
76 bool isCommitted();
77
81 void commit(ByteStreamMaintainer& maintainer);
82
83private:
89 bool sameSign(int first, int second);
90
93 void mergeNodes();
94
97 void clear();
98
100 struct ModificationNode *head;
101 bool committed;
102};
103
104
105CLICK_ENDDECLS
106
107#endif
Class used to manage a flow. Stores the modifications in the flow (bytes removed or inserted) as well...
Definition bytestreammaintainer.hh:31
Template for memory pools.
Definition memorypool.hh:20
Class used to store the modifications performed in a packet's structure.
Definition modificationlist.hh:41
void printList()
Print the current state of the list in the console using click_chatter.
Definition modificationlist.cc:52
bool addModification(uint32_t firstPosition, uint32_t position, int offset)
Add a modification in the list.
Definition modificationlist.cc:66
~ModificationList()
Destruct a ModificationList and free the memory.
Definition modificationlist.cc:25
bool isCommitted()
Indicate whether the list has been committed.
Definition modificationlist.cc:196
void commit(ByteStreamMaintainer &maintainer)
Commit the modifications stored in the list into a ByteStreamMaintainer.
Definition modificationlist.cc:202
Structure representing a node in the linked list of modifications.
Definition modificationlist.hh:24
int offset
Definition modificationlist.hh:26
struct ModificationNode * next
Definition modificationlist.hh:28