[datagram] fix missing ffi library

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[packet] fix clone()

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[datagram] fix creating datagram without packet

When creating empty datagram add a single iovec with an empty buffer.
Also ensure the _parse stack is initialised.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[datagram] fix payload setting

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[lib] Add random_data()

A new function for generating a random binary string with a specified length.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[lib] add deepcopy()

deepcopy implementation from http://lua-users.org/wiki/CopyTable, with added
naive ctype support. C pointers are not properly copied.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[packet] report returnis string, instread of printing it

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[packet] add scatter()

Add a packet function that does the opposite of the coalescse.
It take a packet and returnes a 'scattered' clone of it.
The second argument is a scatter pattern list. It has the form
{ {len, offset}, {len, offset} ... }

An example invocation:

scattered = packet.scatter(p, {{10}, {100, 20}}

This will create a new packet with the following iovec layout:
 - 10 bytes at offset 0
 - 100 bytes starting at offset 20
 - the rest starting at offset 0

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[protocol] header add eq()

Add a method for raw bit-to-bit comapring of header data. This can be overriden
in the ancestors, for more fine comparing (specific flags etc.)

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[protocol] ipv6 add version() dscp() ecn()

dscp and ecn are subfields of the traffic class, should be able to set/get
separetely.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[protocol] add ipv4 support

Add IPv4 support in the protocol library.
This version does not support IPv4 header options (rarely used)

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[protocol] udp support

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[protocol] tcp support

The optional URG pointer and TCP options are nto supported.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
[apps] add fuzz app

The generation is done in 2 phases:
 - payload generation - stacking Raw data, Ethernet, IPv4, IPv6,
   TCP and UDP protocol layers
 - scatter the data to predefined iovec layouts

Each packet is marked at its payload end with a unique number. Upon
receiving this number is used to find the originating match. Their
parsed headers are then compared and verified.

NOTE: This implies that the the packets are received assembled if
any fragmentation was used. So GSO should be enabled on both TX/RX.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Merge pull request #172 from virtualopensystems/fuzz

Fuzz testing app
multi-iovec and jumbo frames
data manipulation at buffer and packet level, multi-iovec aware
app that recognizes and records received packets, useful for testing
test framework
add testfiles, replacing most .selftest() functions