def formatSockaddrInStruct(argument, name, value): if name == "sin_port": return ntoh_ushort(value) if name == "sin_addr": ip = ntoh_uint(value.s_addr) return ip_int2str(ip) return None
def formatStructValue(self, struct, name, value): if struct.startswith("sockaddr") and name.endswith("family"): return SOCKET_FAMILY.get(value, value) if struct == "sockaddr_in": if name == "sin_port": return ntoh_ushort(value) if name == "sin_addr": ip = ntoh_uint(value.s_addr) return IP(ip) return None
def __repr__(self): ip = ntoh_uint(self.s_addr) return ip_int2str(ip)