You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

23 lines
402 B

import struct
import socket
def ip_from_int(ip):
return socket.inet_ntoa(struct.pack(">L", ip))
def ip_to_int(ip):
return struct.unpack(">L", socket.inet_aton(ip))[0]
protobuf_mask = 0x80000000
def is_proto(emsg):
return (int(emsg) & protobuf_mask) > 0
def set_proto_bit(emsg):
return int(emsg) | protobuf_mask
def clear_proto_bit(emsg):
return int(emsg) & ~protobuf_mask