-
Notifications
You must be signed in to change notification settings - Fork 46
/
HACKING
executable file
·48 lines (37 loc) · 1.51 KB
/
HACKING
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
pypacker directory structure
============================
pypacker
examples # usage examples for pypacker
pypacker # pypacker core logic, routines for handling packet-data, protocols sorted by layers
layer12 # protocols for ISO/OSI-layer 1 and 2. The name of the module
# is the same as the main class in this module.
layer3 # ...for layer 3
layer4 # ...for layer 4
layer567 # ...for layer 5, 6 and 7
tests # tests for pypacker logic and protocols
Styleguide
==========
- All official Python style-guidelines *should* be applied except the
preference of space-characters. Tabs must be used throughout
the code:
GLOBAL_XYZ[tab]= 123 # some comment
class someclass()
# some comment
[tab]def xyz(self):
[tab][tab]# Some comment
[tab][tab]var1 = 123 # some comment
[tab][tab]pass
- QA config (pep8, flake8, pylint): see qa_config.txt
Explanation:
W191: Spaces enforced? -> We use TABS!
E128: continuation line under-indented for visual indent -> Looks sh$§
E223: tab before operator -> yep, we use tabs
E265: "#some comment" is ok -> it's readable
- Auto-update header should only be recalculated if VARNAME_au_active is True
- Strings are written using double quotes like "string_xyz"
- Readability is more important than performance
- Avoid overwriting "__getattribute__"
Adding new protocols
====================
See examples/examples_new_protocol.py and pypacker/pypacker.Packet for more informations on creating new protocols.
Every Protocol needs a testcase in tests/test_pypacker.py