Hello, the protoID is a member used by the protocol factory to create and identify different layers. Is an arbitrary number hard-coded inside the library ans is different for each layer.
What do you mean on interpret a RawLayer? To get the raw data given a packet? You don't need to use the protoID for that... Or you added a new protocol to libcrafter?
If you have a packet such as :
Packet pck = Ethernet() / IP() / UDP() /RawLayer();you can access the layer :
RawLayer* raw_layer = pack.GetLayer<RawLayer>();
Then, if you created a new libcrafter layer (protocol) you can construct it given the RawLayer in various ways. One easy way is :
MyNewLayer my_layer;
/* Get size of the raw layer */
size_t data_size = raw_layer.GetSize();
/* Copy all the data */
byte* data = new byte[data_size];
raw_layer.GetData(data);
/* Create the header */
my_layer.PutData(data);
If you are using the version on the git repo you should be able to construct a layer more easily, using the RawLayer as an argument of your layer constructor. Also, if you want your application layer to be automatically interpreted by libcrafter, you can use the "
Bind" method. An example for DNS is over here :
https://github.com/pellegre/libcrafter-examples/blob/master/DNSQuery/main.cpp
Best,