# Path: pysnmp/carrier/asynsock/dgram/udp.py
# class UdpSocketTransport(DgramSocketTransport):
# 
# Path: pysnmp/carrier/asynsock/dgram/udp6.py
#     AF_INET6 = None
# class Udp6SocketTransport(DgramSocketTransport):
# 
# Path: pysnmp/carrier/asynsock/dgram/unix.py
#     AF_UNIX = None
# class UnixSocketTransport(DgramSocketTransport):
#     def openClientMode(self, iface=None):
#     def openServerMode(self, iface):
#     def closeTransport(self):


import socket, sys
from pysnmp.carrier.asynsock.dgram import udp, udp6, unix
from pyasn1.compat.octets import null

    def __hash__(self): return hash(self.transportAddr)
    
    def __eq__(self, other): return self.transportAddr == other
    def __ne__(self, other): return self.transportAddr != other
    def __lt__(self, other): return self.transportAddr < other
    def __le__(self, other): return self.transportAddr <= other
    def __gt__(self, other): return self.transportAddr > other
    def __ge__(self, other): return self.transportAddr >= other
    
    def openClientMode(self):
        self.transport = self.protoTransport().openClientMode()
        return self.transport
 
class UdpTransportTarget(_AbstractTransportTarget):
    transportDomain = udp.domainName
    protoTransport = udp.UdpSocketTransport
    def __init__(self, transportAddr, timeout=1, retries=5, tagList=null):
        _AbstractTransportTarget.__init__(self, transportAddr, timeout,
                                          retries, tagList)
        try:
            self.transportAddr = socket.getaddrinfo(transportAddr[0],
                                                    transportAddr[1],
                                                    socket.AF_INET,
                                                    socket.SOCK_DGRAM,
                                                    socket.IPPROTO_UDP)[0][4][:2]
        except socket.gaierror:
            raise error.PySnmpError('Bad IPv4/UDP transport address %s: %s' % ('@'.join([ str(x) for x in transportAddr ]), sys.exc_info()[1]))

class Udp6TransportTarget(_AbstractTransportTarget):

# Path: pysnmp/carrier/asynsock/dgram/udp.py
# class UdpSocketTransport(DgramSocketTransport):
# 
# Path: pysnmp/carrier/asynsock/dgram/udp6.py
#     AF_INET6 = None
# class Udp6SocketTransport(DgramSocketTransport):
# 
# Path: pysnmp/carrier/asynsock/dgram/unix.py
#     AF_UNIX = None
# class UnixSocketTransport(DgramSocketTransport):
#     def openClientMode(self, iface=None):
#     def openServerMode(self, iface):
#     def closeTransport(self):


# Path: pysnmp/entity/rfc3413/oneliner/target.py
import socket, sys
from pysnmp.carrier.asynsock.dgram import udp, udp6, unix
from pyasn1.compat.octets import null


    def __hash__(self): return hash(self.transportAddr)
    
    def __eq__(self, other): return self.transportAddr == other
    def __ne__(self, other): return self.transportAddr != other
    def __lt__(self, other): return self.transportAddr < other
    def __le__(self, other): return self.transportAddr <= other
    def __gt__(self, other): return self.transportAddr > other
    def __ge__(self, other): return self.transportAddr >= other
    
    def openClientMode(self):
        self.transport = self.protoTransport().openClientMode()
        return self.transport
 
class UdpTransportTarget(_AbstractTransportTarget):
    transportDomain = udp.domainName
    protoTransport = udp.UdpSocketTransport
    def __init__(self, transportAddr, timeout=1, retries=5, tagList=null):
        _AbstractTransportTarget.__init__(self, transportAddr, timeout,
                                          retries, tagList)
        try:
            self.transportAddr = socket.getaddrinfo(transportAddr[0],
                                                    transportAddr[1],
                                                    socket.AF_INET,
                                                    socket.SOCK_DGRAM,
                                                    socket.IPPROTO_UDP)[0][4][:2]
        except socket.gaierror:
            raise error.PySnmpError('Bad IPv4/UDP transport address %s: %s' % ('@'.join([ str(x) for x in transportAddr ]), sys.exc_info()[1]))

class Udp6TransportTarget(_AbstractTransportTarget):

    transportDomain = udp6.domainName