Lines Matching refs:addr
91 def AddressVersion(addr): argument
92 return 6 if ":" in addr else 4
112 def Sockaddr(addr): argument
113 if ":" in addr[0]:
115 if len(addr) == 4:
116 addr, port, flowinfo, scope_id = addr
118 (addr, port), flowinfo, scope_id = addr, 0, 0
119 addr = socket.inet_pton(family, addr)
121 addr, scope_id))
124 addr, port = addr
125 addr = socket.inet_pton(family, addr)
126 return SockaddrIn((family, socket.ntohs(port), addr))
279 def _ToSocketAddress(addr, alen): argument
280 addr = addr[:alen]
285 elif alen == len(SockaddrIn) and SockaddrIn(addr).family == socket.AF_INET:
286 return SockaddrIn(addr)
287 elif alen == len(SockaddrIn6) and SockaddrIn6(addr).family == socket.AF_INET6:
288 return SockaddrIn6(addr)
290 return SockaddrStorage(addr)
292 return addr # Unknown or malformed. Return the raw bytes.
310 addr = ctypes.create_string_buffer(addrlen)
311 msg_name = ctypes.addressof(addr)
330 addr = _ToSocketAddress(addr, msghdr.namelen)
334 return data, addr, msglist
340 addr = ctypes.create_string_buffer(len(SockaddrStorage))
341 alen = ctypes.c_int(len(addr))
344 addr, ctypes.byref(alen))
350 addr = _ToSocketAddress(addr.raw, alen)
352 return data, addr