def process_result_value(self, value, dialect): if value is None: return None if "/" in value: return IPv4(value) else: return IPv4(value, "255.255.255.255")
def handle_read(self): ip = struct.unpack("!i", self.recv(4))[0] # network byte-order port = struct.unpack("!h", self.recv(2))[0] # network byte-order length = struct.unpack("i", self.recv(4))[0] # host byte-order msg = self.recv(length) assert length == len(msg) return self.callback(parse_message(now(), IPv4(ip), msg))
def handle_read(self): try: while 1: msg, addr = self.recvfrom(4096, socket.MSG_DONTWAIT) self.callback(parse_message(now(), IPv4(addr[0]), msg)) except socket.SocketError, err: if err[0] == EAGAIN: return else: raise
def process_bind_param(self, value, dialect): if value is None: return None return IPv4(value).CIDR
def copy_value(self, value): if value is None: return None return IPv4(value)
def process_result_value(self, value, dialect): if value is None: return None return IPv4(value)