8.1.4. Simple Header Value Editor
This module provides a simple way to edit the value of a header in a packet. The purpose of this module is to provide a simple interface for modifying the value of a header in a packet. The module provides a function that takes a packet and a header name as input, and returns the modified packet with the new value for the specified header.
The module is designed to be used in conjunction with the HLAPI stream.packet.header.data.set()
function. Without this module, the user would have to manually set the hex value of the header in the packet. This module simplifies that process by providing a simple interface for modifying the value of a header in a packet.
eth = headers.Ethernet()
eth.src_mac = "aaaa.aaaa.0005"
eth.dst_mac = "bbbb.bbbb.0005"
eth.ethertype = headers.EtherType.NONE
print(str(eth))
# Output will be: BBBBBBBB0005AAAAAAAA0005FFFF
stream.packet.header.data.set(hex_data=Hex(str(eth)))
- class AETH[source]
Bases:
object
ACK EXTENDED TRANSPORT HEADER (AETH) - 4 BYTES
ACK Extended Transport Header contains the additional transport fields for ACK packets. The AETH is only in Acknowledge, RDMA READ Response First, RDMA READ Response Last, and RDMA READ Response Only packets as indicated by the Base Transport Header OpCode field.
- __init__()
- msn = 0
Message Sequence Number indicates the sequence number of the last message completed at the responder
- syndrome = 0
Syndrome indicates if this is an ACK or NAK packet plus additional information about the ACK or NAK
- class BTH[source]
Bases:
object
BASE TRANSPORT HEADER (BTH) - 12 BYTES
Base Transport Header contains the fields for IBA transports.
- __init__(opcode=BTHOpcode.RC_SEND_FIRST)
- ackreq = 0
Acknowledge Request, this bit is used to indicate that an acknowledge (for this packet) should be scheduled by the responder
- destqp = 2
Destination QP indicates the Work Queue Pair Number (QP) at the destination
- migreq = 0
This bit is used to communicate migration state
- opcode = 0
OpCode indicates the IBA packet type. It also specifies which extension headers follow the BTH
- padcnt = 1
Pad Count indicates how many extra bytes are added to the payload to align to a 4 byte boundary
- pkey = 65535
Partition Key indicates which logical Partition is associated with this packet
- psn = 0
Packet Sequence Number is used to detect a missing or duplicate Packet
- reserved = 7
Reserved
- reserved_7bits = 0
Reserved
- se = 0
Solicited Event, this bit indicates that an event should be generated by the responder
- tver = 0
Transport Header Version indicates the version of the IBA Transport Headers
- class DETH[source]
Bases:
object
DATAGRAM EXTENDED TRANSPORT HEADER (DETH) - 8 BYTES
Datagram Extended Transport Header contains the additional transport fields for datagram service. The DETH is only in datagram packets if indicated by the Base Transport Header OpCode field.
- __init__()
- q_key = 0
Queue Key is required to authorize access to the receive queue
- reserved = 0
Reserved
- src_qp = 0
Source QP indicates the Work Queue Pair Number (QP) at the source.
- class DHCPOptionClientIdentifier[source]
Bases:
object
DHCPOptionClientIdentifier(len: int = 7, htype: int = 1, client_mac: str = ‘0000.0000.0000’)
- __init__(len=7, htype=1, client_mac='0000.0000.0000')
- class DHCPOptionMessageType[source]
Bases:
object
DHCPOptionMessageType(type: xoa_driver.functions.headers.DHCPMessageType = <DHCPMessageType.Discover: 1>)
- __init__(type=DHCPMessageType.Discover)
- class DHCPOptionParamRequestList[source]
Bases:
object
DHCPOptionParamRequestList(req_list: list = <factory>)
- __init__(req_list=<factory>)
- class DHCPOptionRequestedIP[source]
Bases:
object
DHCPOptionRequestedIP(ip_addr: str = ‘0.0.0.0’)
- __init__(ip_addr='0.0.0.0')
- class DHCPV4[source]
Bases:
object
DHCPV4(op: xoa_driver.functions.headers.DHCPOpcode = <DHCPOpcode.BootRequest: 1>, htype: int = 1, hlen: int = 6, hops: int = 0, xid: str = ‘00000000’, secs: int = 0, broadcast_flag: int = 0, reserved_flags: int = 0, ciaddr: str = ‘0.0.0.0’, yiaddr: str = ‘0.0.0.0’, siaddr: str = ‘0.0.0.0’, giaddr: str = ‘0.0.0.0’, chaddr: str = ‘0000.0000.0000’, sname: str = ‘’, file: str = ‘’, magic_cookie: str = ‘63825363’)
- __init__(op=DHCPOpcode.BootRequest, htype=1, hlen=6, hops=0, xid='00000000', secs=0, broadcast_flag=0, reserved_flags=0, ciaddr='0.0.0.0', yiaddr='0.0.0.0', siaddr='0.0.0.0', giaddr='0.0.0.0', chaddr='0000.0000.0000', sname='', file='', magic_cookie='63825363')
- broadcast_flag = 0
Broadcast flag
- chaddr = '0000.0000.0000'
Client hardware address (16 bytes). If less than 16 bytes are provided, padding will be used.
- ciaddr = '0.0.0.0'
Client IP address; only filled in if client is in BOUND, RENEW or REBINDING state and can respond to ARP requests.
- file = ''
Boot file name, null terminated string (128 bytes). If less than 128 bytes are provided, padding will be used.
- giaddr = '0.0.0.0'
Relay agent IP address, used in booting via a relay agent.
- hlen = 6
Hardware address length
- hops = 0
Client sets to zero, optionally used by relay agents when booting via a relay agent
- htype = 1
Hardware address type
- op = 1
Message op code / message type
- reserved_flags = 0
Reserved flags, must be zero
- secs = 0
Filled in by client, seconds elapsed since client began address acquisition or renewal process.
- siaddr = '0.0.0.0'
IP address of next server to use in bootstrap; returned in DHCPOFFER, DHCPACK by server.
- sname = ''
Optional server host name, null terminated string (64 bytes). If less than 64 bytes are provided, padding will be used.
- xid = '00000000'
Transaction ID, a random number chosen by the client, used by the client and server to associate messages and responses between a client and a server.
- yiaddr = '0.0.0.0'
‘Your’ (client) IP address.
- class IPV4[source]
Bases:
object
IPV4(version: int = 4, header_length: int = 5, dscp: int = 0, ecn: int = 0, total_length: int = 0, identification: str = ‘0000’, flags: int = 0, offset: int = 0, ttl: int = 255, proto: xoa_driver.functions.headers.IPProtocol = <IPProtocol.NONE: 255>, checksum: str = ‘0000’, src: str = ‘0.0.0.0’, dst: str = ‘0.0.0.0’)
- __init__(version=4, header_length=5, dscp=0, ecn=0, total_length=0, identification='0000', flags=0, offset=0, ttl=255, proto=IPProtocol.NONE, checksum='0000', src='0.0.0.0', dst='0.0.0.0')
- class IPV6[source]
Bases:
object
IPV6(version: int = 6, traff_class: int = 8, flow_label: int = 0, payload_length: int = 0, next_header: xoa_driver.functions.headers.IPProtocol = <IPProtocol.NONE: 255>, hop_limit: int = 1, src: str = ‘2000::2’, dst: str = ‘2000::100’)
- __init__(version=6, traff_class=8, flow_label=0, payload_length=0, next_header=IPProtocol.NONE, hop_limit=1, src='2000::2', dst='2000::100')
- class MACControlPFC[source]
Bases:
object
MACControlPFC(opcode: str = ‘0101’, class_enable_list: list = <factory>, class_quanta_list: list = <factory>)
- __init__(opcode='0101', class_enable_list=<factory>, class_quanta_list=<factory>)
- class MACControlPause[source]
Bases:
object
MACControlPause(opcode: str = ‘0001’, value: int = 65535)
- __init__(opcode='0001', value=65535)
- class MPLS[source]
Bases:
object
MPLS(label: int = 0, exp: int = 0, s: int = 1, ttl: int = 0)
- __init__(label=0, exp=0, s=1, ttl=0)
- class PTP[source]
Bases:
object
PTP(version_ptp: int = 1, version_network: int = 1, subdomain: str = ‘5f44464c540000000000000000000000’, message_type: int = 1, source_comm_tech: int = 1, source_uuid: str = ‘0030051d1e27’, source_port_id: int = 1, seq_id: int = 94, control_field: int = 0, flags: str = ‘0008’, original_timestamp_sec: int = 1163594296, original_timestamp_nsec: int = 247015000, epoch_num: int = 0, current_utc_offset: int = 0, gm_comm_tech: int = 1, gm_clock_uuid: str = ‘0030051d1e27’, gm_port_id: int = 0, gm_seq_id: int = 94, gm_clock_stratum: int = 4, gm_clock_id: str = ‘44464c54’, gm_clock_variance: int = -4000, gm_preferred: int = 0, gm_is_boundary_clock: int = 0, sync_interval: int = 1, local_clock_variance: int = -4000, local_step_removed: int = 0, local_clock_stratum: int = 4, local_clock_id: str = ‘44464c54’, parent_comm_tech: int = 1, parent_clock_uuid: str = ‘0030051D1E27’, parent_port_id: int = 0, est_master_variance: int = 0, est_master_drift: int = 0, utc_reasonable: int = 1)
- __init__(version_ptp=1, version_network=1, subdomain='5f44464c540000000000000000000000', message_type=1, source_comm_tech=1, source_uuid='0030051d1e27', source_port_id=1, seq_id=94, control_field=0, flags='0008', original_timestamp_sec=1163594296, original_timestamp_nsec=247015000, epoch_num=0, current_utc_offset=0, gm_comm_tech=1, gm_clock_uuid='0030051d1e27', gm_port_id=0, gm_seq_id=94, gm_clock_stratum=4, gm_clock_id='44464c54', gm_clock_variance=-4000, gm_preferred=0, gm_is_boundary_clock=0, sync_interval=1, local_clock_variance=-4000, local_step_removed=0, local_clock_stratum=4, local_clock_id='44464c54', parent_comm_tech=1, parent_clock_uuid='0030051D1E27', parent_port_id=0, est_master_variance=0, est_master_drift=0, utc_reasonable=1)
- class RDETH[source]
Bases:
object
RELIABLE DATAGRAM EXTENDED TRANSPORT HEADER (RDETH) - 4 BYTES
Reliable Datagram Extended Transport Header contains the additional transport fields for reliable datagram service. The RDETH is only in Reliable Datagram packets as indicated by the Base Transport Header OpCode field.
- __init__()
- ee_context = 0
EE-Context indicates which End-to-End Context should be used for this Reliable Datagram packet
- reserved = 0
Reserved
- class RETH[source]
Bases:
object
RDMA EXTENDED TRANSPORT HEADER (RETH) - 16 BYTES
RDMA Extended Transport Header contains the additional transport fields for RDMA operations. The RETH is present in only the first (or only) packet of an RDMA Request as indicated by the Base Transport Header OpCode field.
- __init__()
- dma_len = 0
DMA Length indicates the length (in Bytes) of the DMA operation.
- r_key = 0
Remote Key that authorizes access for the RDMA operation
- va = 0
Virtual Address of the RDMA operation
- class TCP[source]
Bases:
object
TCP(src_port: int = 0, dst_port: int = 0, seq_num: int = 0, ack_num: int = 0, header_length: int = 20, rsrvd: int = 0, ae: int = 0, cwr: int = 0, ece: int = 0, urg: int = 0, ack: int = 0, psh: int = 0, rst: int = 0, syn: int = 0, fin: int = 0, window: int = 0, checksum: str = ‘0000’, urgent_pointer: int = 0)
- __init__(src_port=0, dst_port=0, seq_num=0, ack_num=0, header_length=20, rsrvd=0, ae=0, cwr=0, ece=0, urg=0, ack=0, psh=0, rst=0, syn=0, fin=0, window=0, checksum='0000', urgent_pointer=0)
- ack = 0
Acknowledgment
- ae = 0
Accurate ECN
- cwr = 0
Congestion Window Reduced
- ece = 0
ECN-Echo
- fin = 0
Fin
- header_length = 20
Aka. Data Offset (bytes)
- psh = 0
Push
- rsrvd = 0
Reserved 000
- rst = 0
Rest
- syn = 0
Sync
- urg = 0
Urgent
- class UDP[source]
Bases:
object
UDP(src_port: int = 0, dst_port: int = 0, length: int = 8)
- __init__(src_port=0, dst_port=0, length=8)
- class eCPRIGeneralDataTransfer[source]
Bases:
object
eCPRIGeneralDataTransfer(protocol_rev: int = 1, c_bit: int = 0, message_type: str = ‘03’, pc_id: str = ‘12345678’, seq_id: str = ‘87654321’, user_data: str = ‘0f0e0d0c0b0a09080706050403020100’)
- __init__(protocol_rev=1, c_bit=0, message_type='03', pc_id='12345678', seq_id='87654321', user_data='0f0e0d0c0b0a09080706050403020100')