def _read_join_synack(self, bits, size, kind):
        """Read Join Connection option for Responding SYN/ACK.

        Positional arguments:
            * bits - str, 4-bit data
            * size - int, length of option
            * kind - int, 30 (Multipath TCP)

        Returns:
            * dict -- extracted Join Connection (MP_JOIN-SYN/ACK) option for Responding SYN/ACK

        Structure of MP_JOIN-SYN/ACK [RFC 6824]:
                                 1                   2                   3
             0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
            +---------------+---------------+-------+-----+-+---------------+
            |     Kind      |  Length = 16  |Subtype|     |B|   Address ID  |
            +---------------+---------------+-------+-----+-+---------------+
            |                                                               |
            |                Sender's Truncated HMAC (64 bits)              |
            |                                                               |
            +---------------------------------------------------------------+
            |                Sender's Random Number (32 bits)               |
            +---------------------------------------------------------------+

            Octets      Bits        Name                        Description
              0           0     tcp.mp.kind                 Kind (30)
              1           8     tcp.mp.length               Length (16)
              2          16     tcp.mp.subtype              Subtype (1|SYN/ACK)
              2          20     -                           Reserved (must be zero)
              2          23     tcp.mp.join.synack.backup   Backup Path (B)
              3          24     tcp.mp.join.synack.addrid   Address ID
              4          32     tcp.mp.join.synack.hmac     Sender's Truncated HMAC
              12         96     tcp.mp.join.synack.randnum  Sender's Random Number

        """
        adid = self._read_unpack(1)
        hmac = self._read_fileng(8)
        srno = self._read_unpack(4)

        data = dict(
            kind=kind,
            length=size + 1,
            subtype='MP_JOIN-SYN/ACK',
            join=dict(
                synack=dict(
                    backup=True if int(bits[3]) else False,
                    addrid=adid,
                    hmac=hmac,
                    randnum=srno,
                ),
            ),
        )

        return data
def _read_join_synack ( self , bits , size , kind ) : adid = self . _read_unpack ( 1 ) hmac = self . _read_fileng ( 8 ) srno = self . _read_unpack ( 4 ) data = dict ( kind = kind , length = size + 1 , subtype = 'MP_JOIN-SYN/ACK' , join = dict ( synack = dict ( backup = True if int ( bits [ 3 ] ) else False , addrid = adid , hmac = hmac , randnum = srno , ) , ) , ) return data
Read Join Connection option for Responding SYN/ACK.

        Positional arguments:
            * bits - str, 4-bit data
            * size - int, length of option
            * kind - int, 30 (Multipath TCP)

        Returns:
            * dict -- extracted Join Connection (MP_JOIN-SYN/ACK) option for Responding SYN/ACK

        Structure of MP_JOIN-SYN/ACK [RFC 6824]:
                                 1                   2                   3
             0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
            +---------------+---------------+-------+-----+-+---------------+
            |     Kind      |  Length = 16  |Subtype|     |B|   Address ID  |
            +---------------+---------------+-------+-----+-+---------------+
            |                                                               |
            |                Sender's Truncated HMAC (64 bits)              |
            |                                                               |
            +---------------------------------------------------------------+
            |                Sender's Random Number (32 bits)               |
            +---------------------------------------------------------------+

            Octets      Bits        Name                        Description
              0           0     tcp.mp.kind                 Kind (30)
              1           8     tcp.mp.length               Length (16)
              2          16     tcp.mp.subtype              Subtype (1|SYN/ACK)
              2          20     -                           Reserved (must be zero)
              2          23     tcp.mp.join.synack.backup   Backup Path (B)
              3          24     tcp.mp.join.synack.addrid   Address ID
              4          32     tcp.mp.join.synack.hmac     Sender's Truncated HMAC
              12         96     tcp.mp.join.synack.randnum  Sender's Random Number