Next Previous Contents

6. Pseudo Code

6.1 Overview

We implement a simple virtual machine in the kernel module. This machine runs over a TCP packet and handles an internal state, composed of:

The code understood by the virtual machine is made of intruction on 32 bits (in the machine's endian) composed of a mnemonic (8 bits), an option (4 bits) and an operand (20 bits), like below:

0              7 8     11 12                                    31
|    Mnemonic   | Option |              Operand                  |

6.2 Instructions


Code : 01

Test the object defined by the option. If the test is true, the instruction pointer goes from instruction i to instruction i+2. If the test is false, the program continues at instruction i+1.

The test options available are the following:


Code : 02

Program continues running at the instruction which address is the operand.


Code : 03

Adds a TCP option in the TCP options buffer. The inserted TCP option is in the operand and its source is determined by the instruction option.

The following options are available:


Code : 04

Sets the value of an internal register in the virtual machine. The register and the type of operation are determined by the option. The value is in the operand.

The following options are available:


Code : 05

Terminates the program execution and returns the operand.

The available operands are:

6.3 TCP Options

For the various instructions that accept TCP options, the following TCP options are available:

Next Previous Contents