sniffing function added

This commit is contained in:
/jdi/ 2015-09-26 14:02:24 +02:00
parent 699ff4221d
commit 671a9df9d7
5 changed files with 47 additions and 11 deletions

34
src/Utils.h Normal file
View file

@ -0,0 +1,34 @@
/*
* Utils.h
*
* Created on: 24.09.2015
* Author: jdi
*/
#ifndef UTILS_H_
#define UTILS_H_
#include <string>
#include <cstring>
#include "Types.h"
namespace utils {
static void printHex(bytes d) {
if (d.size() > 0)
printf("%.2X", d[0]);
for (unsigned i = 1; i < d.size(); i++) {
printf(":%.2X", d[i]);
}
}
static void printDec(bytes d) {
if (d.size() > 0)
printf("%.1d", d[0]);
for (unsigned i = 1; i < d.size(); i++) {
printf(".%.1d", d[i]);
}
}
}
#endif /* UTILS_H_ */