Example #1
0
def length_block():


    parser = h.sequence(
    h.ch('\x01'),
    h.uint16(),
    h.and_(h._h_length_value(h.uint32(), h.ch_range('\x00', '\xff'))),
    h.uint32(),
    h.many(h.ch_range('\x00', '\xff')),
    h.end_p())
    return parser
Example #2
0
def channel_open_ok_parser():
    parser = h.sequence(
        h.ch('\x01'), # type
        h.uint16(), # Channel
        h.uint32(), # Length
        h.token("\x16\x28"), # Class
        h.token("\x00\x0b"), # Method

        # Arguments
        h.uint32(), # Channel-Id
        h.end_p()
    )
    return parser
Example #3
0
def connection_tune_ok_parser():
    parser = h.sequence(
        h.ch('\x01'), # type
        h.uint16(), # Channel
        h.uint32(), # Length
        h.token("\x00\x0a"), # Class
        h.token("\x00\x1f"), # Method

        # Arguments
        h.uint16(), # Channel max
        h.uint32(), # Frame max
        h.uint16(), # Heartbeat
        h.end_p()
    )
    return parser
Example #4
0
def fast_meter_message():
    header = h.token('\xa5\xd1')
    any_char = h.ch_range('\x00', '\xff')

    parser = h.sequence(header, h.uint8(), h.ch('\x00'),
                        h.repeat_n(h.uint32(), 7), h.uint64(),
                        h.repeat_n(any_char, 167), any_char)
    return parser
Example #5
0
def connection_start_ok_parser():
    parser = h.sequence(
        h.ch('\x01'),  # type
        h.uint16(),  # Channel
        h.uint32(),  # Length
        h.token("\x00\x0a"),  # Class
        h.token("\x00\x0b"),  # Method
        h.end_p()
    )
    return parser
Example #6
0
def basic_deliver_parser():
    parser = h.sequence(
        h.ch('\x01'),  # type
        h.uint16(),  # Channel
        h.uint32(),  # Length
        h.token("\x00\x3c"),  # Class
        h.token("\x00\x3c"),  # Method
        h.end_p()
    )
    return parser
Example #7
0
def connection_close_ok_parser():
    parser = h.sequence(
        h.ch('\x01'),  # type
        h.uint16(),  # Channel
        h.uint32(),  # Length
        h.token("\x00\x0a"),  # Class
        h.token("\x00\x33"),  # Method

        # No arguments
        h.end_p()
    )
    return parser
Example #8
0
def basic_consume_ok_parser():
    parser = h.sequence(
        h.ch('\x01'), # type
        h.uint16(), # Channel
        h.uint32(), # Length
        h.token("\x00\x3c"), # Class
        h.token("\x00\x15"), # Method

        # Arguments
        # consumer-tag
        h.end_p()
    )
    return parser
Example #9
0
def channel_open_parser():
    parser = h.sequence(
        h.ch('\x01'), # type
        h.uint16(), # Channel
        h.uint32(), # Length
        h.token("\x00\x14"), # Class
        h.token("\x00\x0a"), # Method

        # Arguments
        h.ch('\x00'), # Out-of-bounds
        h.end_p()
    )
    return parser
Example #10
0
def connection_open_vhost_ok_parser():
    parser = h.sequence(
        h.ch('\x01'), # type
        h.uint16(), # Channel
        h.uint32(), # Length
        h.token("\x00\x0a"), # Class
        h.token("\x00\x29"), # Method

        # Arguments
        h.ch('\x00'),# Known-Host # most likely going to change this according to the message
        h.end_p()
    )
    return parser
Example #11
0
def connection_close_parser():
    parser = h.sequence(
        h.ch('\x01'),  # type
        h.uint16(),  # Channel
        h.uint32(),  # Length
        h.token("\x00\x0a"),  # Class
        h.token("\x00\x32"),  # Method

        # Arguments
        h.uint16(), # Replay-code
        #Replay-text
        h.uint16(), # Class-Id
        h.uint16(), # Method-Id
        h.end_p()
    )
    return parser
Example #12
0
def basic_consume_parser():
    parser = h.sequence(
        h.ch('\x01'), # type
        h.uint16(), # Channel
        h.uint32(), # Length
        h.token("\x00\x3c"), # Class
        h.token("\x00\x14"), # Method

        # Arguments
        h.uint16(), # Ticket
        # how do you parse that long message? #Queue
        h.many(h.ch_range('\x00', '\xff')),
        # consumer-tag
        h.end_p()
    )
    return parser
Example #13
0
def queue_declare_ok_parser():
    parser = h.sequence(
        h.ch('\x01'), # type
        h.uint16(), # Channel
        h.uint32(), # Length
        h.token("\x00\x32"), # Class
        h.token("\x00\x0b"), # Method

        # Arguments
        #how do you parse that long message? #Queue
        h.many(h.ch_range('\x00', '\xff')),
        #h.uint32(), # message-count
        #h.uint32(), # consumer-count
        h.end_p()
    )
    return parser
Example #14
0
def queue_declare_parser():
    parser = h.sequence(
        h.ch('\x01'), # type
        h.uint16(), # Channel
        h.uint32(), # Length
        h.token("\x00\x32"), # Class
        h.token("\x00\x0a"), # Method

        # Arguments
        h.uint16(), # Ticket
        # how do you parse that long message?#Queue
        h.many(h.ch_range('\x00', '\xff')),
        #When you parse this out... (, ,, , 0L, ('','','',''))
        h.end_p()
    )
    return parser
Example #15
0
 def setUpClass(cls):
     cls.parser = h.uint32()
Example #16
0
 def setUpClass(cls):
     cls.parser = h.uint32()