A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
serializationwrapper.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
3
4
/*
5
* Copyright (c) 2020 DLTLT
6
*
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License version 2 as
9
* published by the Free Software Foundation;
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*
20
* Corresponding author: Niki Hrovatin <niki.hrovatin@famnit.upr.si>
21
*/
22
23
24
#ifndef SERIALIZATIONWRAPPER_H
25
#define SERIALIZATIONWRAPPER_H
26
27
#include <fstream>
28
#include <iostream>
29
#include <string>
30
#include "ns3/header.h"
31
#include "ns3/network-module.h"
32
#include "ns3/packet.h"
33
#include "ns3/proto-packet.pb.h"
34
35
namespace
ns3
{
36
54
class
SerializationWrapper
:
public
Header
55
{
56
public
:
64
void
SetData
(
protomessage::ProtoPacket
message);
65
73
void
GetData
(
protomessage::ProtoPacket
*message);
74
80
static
TypeId
GetTypeId
(
void
);
81
87
SerializationWrapper
();
88
89
virtual
~SerializationWrapper
();
90
98
SerializationWrapper
(
protomessage::ProtoPacket
message);
99
104
virtual
TypeId
GetInstanceTypeId
(
void
)
const
;
105
112
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
113
121
virtual
void
Serialize
(Buffer::Iterator start)
const
;
131
virtual
uint32_t
Deserialize
(Buffer::Iterator start);
132
138
virtual
void
Print
(std::ostream &os)
const
;
139
140
int
m_dataSize
= 0;
141
142
uint8_t *
m_data
;
143
};
144
}
// namespace ns3
145
146
#endif
/* SERIALIZATIONWRAPPER_H */
ns3::SerializationWrapper::m_dataSize
int m_dataSize
holds the size of the serialized data in bytes
Definition:
serializationwrapper.h:140
ns3::SerializationWrapper::Serialize
virtual void Serialize(Buffer::Iterator start) const
serialize the data
Definition:
serializationwrapper.cc:102
ns3
Definition:
sensornode-helper.cc:26
ns3::SerializationWrapper::m_data
uint8_t * m_data
the serialized data
Definition:
serializationwrapper.h:142
ns3::SerializationWrapper::SetData
void SetData(protomessage::ProtoPacket message)
Setter of the data in the protocol header.
Definition:
serializationwrapper.cc:58
ns3::SerializationWrapper::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
compute the serialized size of the data
Definition:
serializationwrapper.cc:91
ns3::SerializationWrapper::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition:
serializationwrapper.cc:31
ns3::SerializationWrapper
Class for the serialization-deserialization of the messagess to send in packets.
Definition:
serializationwrapper.h:54
ns3::SerializationWrapper::~SerializationWrapper
virtual ~SerializationWrapper()
Definition:
serializationwrapper.cc:51
ns3::SerializationWrapper::SerializationWrapper
SerializationWrapper()
Default constructor.
Definition:
serializationwrapper.cc:47
ns3::SerializationWrapper::Print
virtual void Print(std::ostream &os) const
dummy printing of the serialized data
Definition:
serializationwrapper.cc:129
ns3::SerializationWrapper::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)
deserialize the data
Definition:
serializationwrapper.cc:110
protomessage::ProtoPacket
Definition:
proto-packet.pb.h:598
ns3::SerializationWrapper::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Definition:
serializationwrapper.cc:42
ns3::SerializationWrapper::GetData
void GetData(protomessage::ProtoPacket *message)
Getter of the data in the protocol header.
Definition:
serializationwrapper.cc:78
src
onion_routing_wsn
protocol
serializationwrapper.h
Generated on Mon Feb 7 2022 13:31:58 for ns-3 by
1.8.17