资 源 简 介
Lua bitstring parsing and creation library based on Erlang bit syntax. Bitstring is useful for network protocol programming and for manipulation of bit based file formats. It provides conversion of strings to binary and hexadecimal formats
Example
Parsing and creation of EAP-TLS message
EAP-TLS protocol defined in RFC 2716
```
code, identifier, length, eap_type,
Lbit, Mbit, Sbit, Rbits =
bitstring.unpack(
"8:int, 8:int, 16:int:big, 8:int,
1:int, 1:int, 1:int, 5:int",
eaptlsmessage);
composedeaptls_message = bitstring.pack(
"8:int, 8:int, 16:int:big, 8:int,
1:int, 1:int, 1:int, 5:int",
code, identifier, length, eap_type,
Lbit, Mbit, Sbit, Rbits)
```
Parsing IP packet
IP header format is defined in RFC 791 paragraph 3.1
```
local
version, ihl, typeofservice, total_length,
identification, reserved, df, mf, fragment_offset,