In [1]:
    
from konfoo import Index, Byteorder, IPv4Address
    
Item type of the field class.
In [2]:
    
IPv4Address.item_type
    
    Out[2]:
Checks if the field class is a bit field.
In [3]:
    
IPv4Address.is_bit()
    
    Out[3]:
Checks if the field class is a boolean field.
In [4]:
    
IPv4Address.is_bool()
    
    Out[4]:
Checks if the field class is a decimal number field.
In [5]:
    
IPv4Address.is_decimal()
    
    Out[5]:
Checks if the field class is a floating point number field.
In [6]:
    
IPv4Address.is_float()
    
    Out[6]:
Checks if the field class is a pointer field.
In [7]:
    
IPv4Address.is_pointer()
    
    Out[7]:
Checks if the field class is a stream field.
In [8]:
    
IPv4Address.is_stream()
    
    Out[8]:
Checks if the field class is a string field.
In [9]:
    
IPv4Address.is_string()
    
    Out[9]:
In [10]:
    
ipv4 = IPv4Address(byte_order='auto')
    
In [11]:
    
ipv4 = IPv4Address()
    
In [12]:
    
ipv4
    
    Out[12]:
In [13]:
    
str(ipv4)
    
    Out[13]:
In [14]:
    
repr(ipv4)
    
    Out[14]:
In [15]:
    
ipv4.name
    
    Out[15]:
In [16]:
    
ipv4.index
    
    Out[16]:
Byte index of the field within the byte stream.
In [17]:
    
ipv4.index.byte
    
    Out[17]:
Bit offset relative to the byte index of the field within the byte stream.
In [18]:
    
ipv4.index.bit
    
    Out[18]:
Absolute address of the field within the data source.
In [19]:
    
ipv4.index.address
    
    Out[19]:
Base address of the byte stream within the data source.
In [20]:
    
ipv4.index.base_address
    
    Out[20]:
Indexes the field and returns the index after the field.
In [21]:
    
ipv4.index_field(index=Index())
    
    Out[21]:
In [22]:
    
ipv4.alignment
    
    Out[22]:
Byte size of the field group which the field is aligned to.
In [23]:
    
ipv4.alignment.byte_size
    
    Out[23]:
Bit offset of the field within its aligned field group.
In [24]:
    
ipv4.alignment.bit_offset
    
    Out[24]:
In [25]:
    
ipv4.bit_size
    
    Out[25]:
In [26]:
    
ipv4.byte_order
    
    Out[26]:
In [27]:
    
ipv4.byte_order.value
    
    Out[27]:
In [28]:
    
ipv4.byte_order.name
    
    Out[28]:
In [29]:
    
ipv4.byte_order = 'auto'
    
In [30]:
    
ipv4.byte_order = Byteorder.auto
    
Checks if the decimal field is signed or unsigned.
In [31]:
    
ipv4.signed
    
    Out[31]:
Maximal decimal field value.
In [32]:
    
ipv4.max()
    
    Out[32]:
Minimal decimal field value.
In [33]:
    
ipv4.min()
    
    Out[33]:
Returns the ipv4address field value as an IPv4 address formatted string.
In [34]:
    
ipv4.value
    
    Out[34]:
Returns the decimal field value aligned to its field group as a number of bytes.
In [35]:
    
bytes(ipv4)
    
    Out[35]:
In [36]:
    
bytes(ipv4).hex()
    
    Out[36]:
Returns the decimal field value as an integer number.
In [37]:
    
int(ipv4)
    
    Out[37]:
Returns the decimal field value as an floating point number.
In [38]:
    
float(ipv4)
    
    Out[38]:
Returns the decimal field value as a lowercase hexadecimal string prefixed with 0x.
In [39]:
    
hex(ipv4)
    
    Out[39]:
Returns the decimal field value as a binary string prefixed with 0b.
In [40]:
    
bin(ipv4)
    
    Out[40]:
Returns the decimal field value as an octal string prefixed with 0o.
In [41]:
    
oct(ipv4)
    
    Out[41]:
Returns the decimal field value as a boolean value.
In [42]:
    
bool(ipv4)
    
    Out[42]:
Returns the decimal field value as a signed integer number.
In [43]:
    
ipv4.as_signed()
    
    Out[43]:
Returns the decimal field value as an unsigned integer number.
In [44]:
    
ipv4.as_unsigned()
    
    Out[44]:
Returns the meatadata of the field as an ordered dictionary.
In [45]:
    
ipv4.describe()
    
    Out[45]:
In [46]:
    
ipv4.deserialize(bytes.fromhex('01000000'), byte_order='little')
    
    Out[46]:
In [47]:
    
ipv4.value
    
    Out[47]:
In [48]:
    
bytes(ipv4)
    
    Out[48]:
In [49]:
    
bytes(ipv4).hex()
    
    Out[49]:
In [50]:
    
int(ipv4)
    
    Out[50]:
In [51]:
    
float(ipv4)
    
    Out[51]:
In [52]:
    
hex(ipv4)
    
    Out[52]:
In [53]:
    
bin(ipv4)
    
    Out[53]:
In [54]:
    
oct(ipv4)
    
    Out[54]:
In [55]:
    
bool(ipv4)
    
    Out[55]:
In [56]:
    
buffer = bytearray()
    
In [57]:
    
ipv4.value = 1
    
In [58]:
    
ipv4.value = 0x1
    
In [59]:
    
ipv4.value = 0b1
    
In [60]:
    
ipv4.value = 0o1
    
In [61]:
    
ipv4.value = True
    
In [62]:
    
ipv4.value = '0.0.0.1'
    
In [63]:
    
ipv4.serialize(buffer, byte_order='little')
    
    Out[63]:
In [64]:
    
buffer.hex()
    
    Out[64]:
In [65]:
    
bytes(ipv4).hex()
    
    Out[65]:
In [ ]: