# Path: pysnmp/carrier/asynsock/dgram/base.py
# class DgramSocketTransport(AbstractSocketTransport):
#     sockType = socket.SOCK_DGRAM
#     retryCount = 3; retryInterval = 1
#     def __init__(self, sock=None, sockMap=None):
#         self.__outQueue = []
#         AbstractSocketTransport.__init__(self, sock, sockMap)
#         
#     def openClientMode(self, iface=None):
#         if iface is not None:
#             try:
#                 self.socket.bind(iface)
#             except socket.error:
#                 raise error.CarrierError('bind() for %s failed: %s' % (iface is None and "<all local>" or iface, sys.exc_info()[1],))
#         return self
#     
#     def openServerMode(self, iface):
#         try:
#             self.socket.bind(iface)
#         except socket.error:
#             raise error.CarrierError('bind() for %s failed: %s' % (iface, sys.exc_info()[1],))
#         return self
# 
#     def sendMessage(self, outgoingMessage, transportAddress):
#         self.__outQueue.append(
#             (outgoingMessage, transportAddress)
#             )
# 
#     # asyncore API
#     def handle_connect(self): pass
#     def writable(self): return self.__outQueue
#     def handle_write(self):
#         outgoingMessage, transportAddress = self.__outQueue.pop()
#         debug.logger & debug.flagIO and debug.logger('handle_write: transportAddress %r -> %r outgoingMessage %s' % (self.socket.getsockname(), transportAddress, debug.hexdump(outgoingMessage)))
#         if not transportAddress:
#             debug.logger & debug.flagIO and debug.logger('handle_write: missing dst address, loosing outgoing msg')
#             return
#         try:
#             self.socket.sendto(outgoingMessage, transportAddress)
#         except socket.error:
#             if sys.exc_info()[1].args[0] in sockErrors:
#                 debug.logger & debug.flagIO and debug.logger('handle_write: ignoring socket error %s' % (sys.exc_info()[1],))
#             else:
#                 raise error.CarrierError('sendto() failed for %s: %s' % (transportAddress, sys.exc_info()[1]))
#             
#     def readable(self): return 1
#     def handle_read(self):
#         try:
#             incomingMessage, transportAddress = self.socket.recvfrom(65535)
#             debug.logger & debug.flagIO and debug.logger('handle_read: transportAddress %r -> %r incomingMessage %s' % (transportAddress, self.socket.getsockname(), debug.hexdump(incomingMessage)))
#             if not incomingMessage:
#                 self.handle_close()
#                 return
#             else:
#                 self._cbFun(self, transportAddress, incomingMessage)
#                 return
#         except socket.error:
#             if sys.exc_info()[1].args[0] in sockErrors:
#                 debug.logger & debug.flagIO and debug.logger('handle_read: known socket error %s' % (sys.exc_info()[1],))
#                 sockErrors[sys.exc_info()[1].args[0]] and self.handle_close()
#                 return
#             else:
#                 raise error.CarrierError('recvfrom() failed: %s' % (sys.exc_info()[1],))
#     def handle_close(self): pass # no datagram connection


    from socket import AF_INET6
from pysnmp.carrier.asynsock.dgram.base import DgramSocketTransport
# Implements asyncore-based UDP6 transport domain
try:
except:
    AF_INET6 = None

domainName = snmpUDP6Domain = (1, 3, 6, 1, 2, 1, 100, 1, 2)


# Path: pysnmp/carrier/asynsock/dgram/base.py
# class DgramSocketTransport(AbstractSocketTransport):
#     sockType = socket.SOCK_DGRAM
#     retryCount = 3; retryInterval = 1
#     def __init__(self, sock=None, sockMap=None):
#         self.__outQueue = []
#         AbstractSocketTransport.__init__(self, sock, sockMap)
#         
#     def openClientMode(self, iface=None):
#         if iface is not None:
#             try:
#                 self.socket.bind(iface)
#             except socket.error:
#                 raise error.CarrierError('bind() for %s failed: %s' % (iface is None and "<all local>" or iface, sys.exc_info()[1],))
#         return self
#     
#     def openServerMode(self, iface):
#         try:
#             self.socket.bind(iface)
#         except socket.error:
#             raise error.CarrierError('bind() for %s failed: %s' % (iface, sys.exc_info()[1],))
#         return self
# 
#     def sendMessage(self, outgoingMessage, transportAddress):
#         self.__outQueue.append(
#             (outgoingMessage, transportAddress)
#             )
# 
#     # asyncore API
#     def handle_connect(self): pass
#     def writable(self): return self.__outQueue
#     def handle_write(self):
#         outgoingMessage, transportAddress = self.__outQueue.pop()
#         debug.logger & debug.flagIO and debug.logger('handle_write: transportAddress %r -> %r outgoingMessage %s' % (self.socket.getsockname(), transportAddress, debug.hexdump(outgoingMessage)))
#         if not transportAddress:
#             debug.logger & debug.flagIO and debug.logger('handle_write: missing dst address, loosing outgoing msg')
#             return
#         try:
#             self.socket.sendto(outgoingMessage, transportAddress)
#         except socket.error:
#             if sys.exc_info()[1].args[0] in sockErrors:
#                 debug.logger & debug.flagIO and debug.logger('handle_write: ignoring socket error %s' % (sys.exc_info()[1],))
#             else:
#                 raise error.CarrierError('sendto() failed for %s: %s' % (transportAddress, sys.exc_info()[1]))
#             
#     def readable(self): return 1
#     def handle_read(self):
#         try:
#             incomingMessage, transportAddress = self.socket.recvfrom(65535)
#             debug.logger & debug.flagIO and debug.logger('handle_read: transportAddress %r -> %r incomingMessage %s' % (transportAddress, self.socket.getsockname(), debug.hexdump(incomingMessage)))
#             if not incomingMessage:
#                 self.handle_close()
#                 return
#             else:
#                 self._cbFun(self, transportAddress, incomingMessage)
#                 return
#         except socket.error:
#             if sys.exc_info()[1].args[0] in sockErrors:
#                 debug.logger & debug.flagIO and debug.logger('handle_read: known socket error %s' % (sys.exc_info()[1],))
#                 sockErrors[sys.exc_info()[1].args[0]] and self.handle_close()
#                 return
#             else:
#                 raise error.CarrierError('recvfrom() failed: %s' % (sys.exc_info()[1],))
#     def handle_close(self): pass # no datagram connection


# Path: pysnmp/carrier/asynsock/dgram/udp6.py
    from socket import AF_INET6
from pysnmp.carrier.asynsock.dgram.base import DgramSocketTransport

# Implements asyncore-based UDP6 transport domain
try:
except:
    AF_INET6 = None

domainName = snmpUDP6Domain = (1, 3, 6, 1, 2, 1, 100, 1, 2)


class Udp6SocketTransport(DgramSocketTransport):