Ejemplo n.º 1
0
    def setUp_with_sack(self):
        self.flags = 0
        self.length = 16 + 2 * 2 * 5 + 4 * 5
        self.tsn_ack = 123456
        self.a_rwnd = 9876
        self.gapack_num = 5
        self.duptsn_num = 5
        self.gapacks = [[2, 3], [10, 12], [20, 24], [51, 52], [62, 63]]
        self.duptsns = [123458, 123466, 123476, 123507, 123518]

        self.sack = sctp.chunk_sack(
            tsn_ack=self.tsn_ack, a_rwnd=self.a_rwnd,
            gapack_num=self.gapack_num, duptsn_num=self.duptsn_num,
            gapacks=self.gapacks, duptsns=self.duptsns)

        self.chunks = [self.sack]

        self.sc = sctp.sctp(
            self.src_port, self.dst_port, self.vtag, self.csum,
            self.chunks)

        self.buf += '\x03\x00\x00\x38\x00\x01\xe2\x40' + \
            '\x00\x00\x26\x94\x00\x05\x00\x05' + \
            '\x00\x02\x00\x03\x00\x0a\x00\x0c\x00\x14\x00\x18' + \
            '\x00\x33\x00\x34\x00\x3e\x00\x3f' + \
            '\x00\x01\xe2\x42\x00\x01\xe2\x4a\x00\x01\xe2\x54' + \
            '\x00\x01\xe2\x73\x00\x01\xe2\x7e'
Ejemplo n.º 2
0
    def setUp_with_multi_chunks(self):
        self.s_flags = 0
        self.s_length = 16
        self.s_tsn_ack = 123456
        self.s_a_rwnd = 9876
        self.s_gapack_num = 0
        self.s_duptsn_num = 0
        self.s_gapacks = None
        self.s_duptsns = None

        self.sack = sctp.chunk_sack(
            tsn_ack=self.s_tsn_ack, a_rwnd=self.s_a_rwnd)

        self.d1_unordered = 0
        self.d1_begin = 1
        self.d1_end = 0
        self.d1_length = 16 + 10
        self.d1_tsn = 12345
        self.d1_sid = 1
        self.d1_seq = 0
        self.d1_payload_id = 0
        self.d1_payload_data = '\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a'

        self.data1 = sctp.chunk_data(
            begin=self.d1_begin, tsn=self.d1_tsn, sid=self.d1_sid,
            payload_data=self.d1_payload_data)

        self.d2_unordered = 0
        self.d2_begin = 0
        self.d2_end = 1
        self.d2_length = 16 + 10
        self.d2_tsn = 12346
        self.d2_sid = 1
        self.d2_seq = 1
        self.d2_payload_id = 0
        self.d2_payload_data = '\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a'

        self.data2 = sctp.chunk_data(
            end=self.d2_end, tsn=self.d2_tsn, sid=self.d2_sid,
            seq=self.d2_seq, payload_data=self.d2_payload_data)

        self.chunks = [self.sack, self.data1, self.data2]

        self.sc = sctp.sctp(
            self.src_port, self.dst_port, self.vtag, self.csum,
            self.chunks)

        self.buf += '\x03\x00\x00\x10\x00\x01\xe2\x40' + \
            '\x00\x00\x26\x94\x00\x00\x00\x00' + \
            '\x00\x02\x00\x1a\x00\x00\x30\x39\x00\x01\x00\x00' + \
            '\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a' + \
            '\x00\x01\x00\x1a\x00\x00\x30\x3a\x00\x01\x00\x01' + \
            '\x00\x00\x00\x00\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a'