1# $Id: rx.py 23 2006-11-08 15:45:33Z jonojono $
2# -*- coding: utf-8 -*-
3"""Rx Protocol."""
4from __future__ import absolute_import
5
6from . import dpkt
7
8# Types
9DATA = 0x01
10ACK = 0x02
11BUSY = 0x03
12ABORT = 0x04
13ACKALL = 0x05
14CHALLENGE = 0x06
15RESPONSE = 0x07
16DEBUG = 0x08
17
18# Flags
19CLIENT_INITIATED = 0x01
20REQUEST_ACK = 0x02
21LAST_PACKET = 0x04
22MORE_PACKETS = 0x08
23SLOW_START_OK = 0x20
24JUMBO_PACKET = 0x20
25
26# Security
27SEC_NONE = 0x00
28SEC_BCRYPT = 0x01
29SEC_RXKAD = 0x02
30SEC_RXKAD_ENC = 0x03
31
32
33class Rx(dpkt.Packet):
34    """Rx Protocol.
35
36    TODO: Longer class information....
37
38    Attributes:
39        __hdr__: Header fields of Rx.
40        TODO.
41    """
42
43    __hdr__ = (
44        ('epoch', 'I', 0),
45        ('cid', 'I', 0),
46        ('call', 'I', 1),
47        ('seq', 'I', 0),
48        ('serial', 'I', 1),
49        ('type', 'B', 0),
50        ('flags', 'B', CLIENT_INITIATED),
51        ('status', 'B', 0),
52        ('security', 'B', 0),
53        ('sum', 'H', 0),
54        ('service', 'H', 0)
55    )
56