示例#1
0
 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")
示例#2
0
 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))
示例#3
0
 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
示例#4
0
 def process_bind_param(self, value, dialect):
     if value is None:
         return None
     return IPv4(value).CIDR
示例#5
0
 def copy_value(self, value):
     if value is None:
         return None
     return IPv4(value)
示例#6
0
 def process_result_value(self, value, dialect):
     if value is None:
         return None
     return IPv4(value)