79 int command(
int,
const char *
const *);
172 template <
typename T>
176 if (_num_compressed_bits <
sizeof(_header_field) * 8) {
177 bitset<
sizeof(_header_field) * 8> my_bitset(_header_field);
178 if (my_bitset[_num_compressed_bits - 1] == 1) {
179 for (
size_t i = _num_compressed_bits;
180 i <
sizeof(_header_field) * 8;
185 return static_cast<T
>(my_bitset.to_ulong());
187 return _header_field;
202 static std::string
hexdump(std::string);
206 static std::string
hex_bytes(
const char &,
const uint32_t &);
207 static std::string
hex_bytes(
const int8_t &,
const uint32_t &);
208 static std::string
hex_bytes(
const int16_t &,
const uint32_t &);
209 static std::string
hex_bytes(
const int32_t &,
const uint32_t &);
210 static std::string
hex_bytes(
const int64_t &,
const uint32_t &);
211 static std::string
hex_bytes(
const uint8_t &,
const uint32_t &);
212 static std::string
hex_bytes(
const uint16_t &,
const uint32_t &);
213 static std::string
hex_bytes(
const uint32_t &,
const uint32_t &);
214 static std::string
hex_bytes(
const uint64_t &,
const uint32_t &);
216 static std::string
hexdump(
const char *,
size_t);
218 static std::string
bindump(std::string);
220 static std::string
bindump(
const char *,
size_t);
231 virtual size_t packMyHdr(Packet *,
unsigned char *,
size_t);
233 virtual size_t unpackMyHdr(
unsigned char *,
size_t, Packet *);
254 size_t get(
unsigned char *buffer,
size_t offset,
void *val,
size_t h);
267 size_t put(
unsigned char *buffer,
size_t offset,
void *val,
size_t h);
270 std::vector<packer *>
Class exploited by the Uwal module to map an NS-Miracle packet into a bit stream, and vice-versa.
std::vector< size_t > n_bits
Vector of elements containing the indication of the number of bits to consider for each header field.
size_t getPayloadBytesLength()
virtual size_t packMyHdr(Packet *, unsigned char *, size_t)
static std::string hexdump_nice(std::string)
Function used for log and debug purposes (in order to print binary strings, even if they contain spec...
virtual void printMyHdrMap()
virtual void printMyHdrFields(Packet *)
Packet * unpackHdr(Packet *)
int command(int, const char *const *)
Method to map tcl commands into c++ methods.
size_t PKT_ID_Bits
Bit length of the srcID_ field to be put in the header stream of bits.
size_t put(unsigned char *buffer, size_t offset, void *val, size_t h)
Method used to map in a certain number of bits, contained in a buffer of chars, a given variable.
std::vector< packer * > activePackers
Vector of elements containing the pointers to the active packers (i.e., the derived classed of packer...
size_t getHdrBytesLength()
size_t DUMMY_CONTENT_Bits
Bit length of the Mbit_ field to be put in the header stream of bits.
~packer()
Class destructor.
static std::string bindump(std::string)
size_t M_BIT_Bits
Bit length of the frameID_ field to be put in the header stream of bits.
std::string packPayload(Packet *)
Method to map an NS-Miracle packet into a legal modem payload (i.e., a string of binary characters) w...
size_t FRAME_OFFSET_Bits
Bit length of the pktID_ field to be put in the header stream of bits.
static std::string hex_bytes(float)
size_t get(unsigned char *buffer, size_t offset, void *val, size_t h)
Method used to retrieve a given variable from a certain number of bits contained in a buffer of chars...
size_t getMyHdrBinLength()
size_t hdr_length
The minimum number of elements that a buffer of char must have in order to store the header fields of...
static T restoreSignedValue(T _header_field, const uint32_t &_num_compressed_bits)
static std::string hexdump(std::string)
int debug_
Flag to enable debug messages.
size_t payload_length
The minimum number of elements that a buffer of char must have in order to store the fields to be cod...
Packet * unpackPayload(Packet *)
Method to de-map a legal modem payload (i.e., a string of binary characters) into an NS-Miracle packe...
virtual void printMyHdrField(Packet *, int)
size_t getPayloadBinLength()
std::string packHdr(Packet *)
virtual size_t unpackMyHdr(unsigned char *, size_t, Packet *)
Header of the class providing the Uwal header's description.