1 |
2 |
dargor |
|
2 |
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
3 |
|
|
<html><head><title>Python: class basic_protocol</title>
|
4 |
|
|
</head><body bgcolor="#f0f0f8">
|
5 |
|
|
<p>
|
6 |
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
7 |
|
|
<tr bgcolor="#ffc8d8">
|
8 |
|
|
<td colspan=3 valign=bottom> <br>
|
9 |
|
|
<font color="#000000" face="helvetica, arial"><strong>nocmodel.basicmodels.basic_protocol</strong> = <a name="nocmodel.basicmodels.basic_protocol">class basic_protocol</a>(<a href="nocmodel.noc_base.html#protocol">nocmodel.noc_base.protocol</a>)</font></td></tr>
|
10 |
|
|
|
11 |
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
12 |
|
|
<td colspan=2><tt>Basic protocol class<br>
|
13 |
|
|
<br>
|
14 |
|
|
This class simplify protocol object creation. It defines a simple packet<br>
|
15 |
|
|
with the following fields:<br>
|
16 |
|
|
<br>
|
17 |
|
|
|0 7|8 15|16 31|<br>
|
18 |
|
|
| src | dst | data |<br> </tt></td></tr>
|
19 |
|
|
<tr><td> </td>
|
20 |
|
|
<td width="100%"><dl><dt>Method resolution order:</dt>
|
21 |
|
|
<dd><a href="nocmodel.basicmodels.basic_protocol.html#basic_protocol">basic_protocol</a></dd>
|
22 |
|
|
<dd><a href="nocmodel.noc_base.html#protocol">nocmodel.noc_base.protocol</a></dd>
|
23 |
|
|
<dd><a href="nocmodel.noc_base.html#nocobject">nocmodel.noc_base.nocobject</a></dd>
|
24 |
|
|
</dl>
|
25 |
|
|
<hr>
|
26 |
|
|
Methods defined here:<br>
|
27 |
|
|
<dl><dt><a name="basic_protocol-__init__"><strong>__init__</strong></a>(self)</dt></dl>
|
28 |
|
|
|
29 |
|
|
<hr>
|
30 |
|
|
Methods inherited from <a href="nocmodel.noc_base.html#protocol">nocmodel.noc_base.protocol</a>:<br>
|
31 |
|
|
<dl><dt><a name="basic_protocol-get_protocol_ref"><strong>get_protocol_ref</strong></a>(self)</dt></dl>
|
32 |
|
|
|
33 |
|
|
<dl><dt><a name="basic_protocol-newpacket"><strong>newpacket</strong></a>(self, zerodefault<font color="#909090">=True</font>, *args, **kwargs)</dt><dd><tt>Return a new packet with all required fields.<br>
|
34 |
|
|
<br>
|
35 |
|
|
Arguments:<br>
|
36 |
|
|
* zerodefault: If True, all missing fields will be zeroed by default.<br>
|
37 |
|
|
If False, a missing value in arguments will throw an exception.<br>
|
38 |
|
|
* args: Nameless arguments will add field values based on packet field<br>
|
39 |
|
|
order.<br>
|
40 |
|
|
* kwargs: Key-based arguments will add specified field values based in <br>
|
41 |
|
|
its keys<br>
|
42 |
|
|
<br>
|
43 |
|
|
Notes: <br>
|
44 |
|
|
* kwargs takes precedence over args: i.e. named arguments can overwrite<br>
|
45 |
|
|
nameless arguments.</tt></dd></dl>
|
46 |
|
|
|
47 |
|
|
<dl><dt><a name="basic_protocol-register_packet_generator"><strong>register_packet_generator</strong></a>(self, packet_class)</dt><dd><tt>Register a special packet generator class.<br>
|
48 |
|
|
<br>
|
49 |
|
|
Must be a derived class of packet</tt></dd></dl>
|
50 |
|
|
|
51 |
|
|
<dl><dt><a name="basic_protocol-update_packet_field"><strong>update_packet_field</strong></a>(self, name, type, bitlen, description<font color="#909090">=''</font>)</dt><dd><tt>Add or update a packet field.<br>
|
52 |
|
|
<br>
|
53 |
|
|
Arguments<br>
|
54 |
|
|
* name<br>
|
55 |
|
|
* type: string that can be "int", "fixed" or "float"<br>
|
56 |
|
|
* bitlen: bit length of this field<br>
|
57 |
|
|
* description: optional description of this field<br>
|
58 |
|
|
<br>
|
59 |
|
|
Notes: <br>
|
60 |
|
|
* Each new field will be added at the end.</tt></dd></dl>
|
61 |
|
|
|
62 |
|
|
</td></tr></table>
|
63 |
|
|
</body></html>
|