diff options
author | Ilya Etingof <etingof@gmail.com> | 2018-12-29 23:45:49 +0100 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2018-12-30 00:12:21 +0100 |
commit | 695e84ab17955fa1a3603f560113bad7f4446716 (patch) | |
tree | 72273a5c2cdc0d219e15678af44babb6bf53e39e /pysnmp/carrier | |
parent | 27082a9663de244b58a895b5c75c59c9e24df057 (diff) | |
download | pysnmp-git-695e84ab17955fa1a3603f560113bad7f4446716.tar.gz |
Extend copyright notice to year 2019
Diffstat (limited to 'pysnmp/carrier')
24 files changed, 155 insertions, 18 deletions
diff --git a/pysnmp/carrier/asyncio/base.py b/pysnmp/carrier/asyncio/base.py index 3b09b3af..ce1b644f 100644 --- a/pysnmp/carrier/asyncio/base.py +++ b/pysnmp/carrier/asyncio/base.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # # Copyright (C) 2014, Zebra Technologies diff --git a/pysnmp/carrier/asyncio/dgram/base.py b/pysnmp/carrier/asyncio/dgram/base.py index af649db6..a845fa1e 100644 --- a/pysnmp/carrier/asyncio/dgram/base.py +++ b/pysnmp/carrier/asyncio/dgram/base.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # # Copyright (C) 2014, Zebra Technologies diff --git a/pysnmp/carrier/asyncio/dgram/udp.py b/pysnmp/carrier/asyncio/dgram/udp.py index c407eb4a..41ada723 100644 --- a/pysnmp/carrier/asyncio/dgram/udp.py +++ b/pysnmp/carrier/asyncio/dgram/udp.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # # Copyright (C) 2014, Zebra Technologies diff --git a/pysnmp/carrier/asyncio/dgram/udp6.py b/pysnmp/carrier/asyncio/dgram/udp6.py index 12fba842..bc03b447 100644 --- a/pysnmp/carrier/asyncio/dgram/udp6.py +++ b/pysnmp/carrier/asyncio/dgram/udp6.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # import socket diff --git a/pysnmp/carrier/asyncio/dispatch.py b/pysnmp/carrier/asyncio/dispatch.py index 74f9ae10..e92fe95e 100644 --- a/pysnmp/carrier/asyncio/dispatch.py +++ b/pysnmp/carrier/asyncio/dispatch.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # # Copyright (C) 2014, Zebra Technologies diff --git a/pysnmp/carrier/asyncore/base.py b/pysnmp/carrier/asyncore/base.py index a1424d7d..61c55221 100644 --- a/pysnmp/carrier/asyncore/base.py +++ b/pysnmp/carrier/asyncore/base.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # import socket diff --git a/pysnmp/carrier/asyncore/dgram/base.py b/pysnmp/carrier/asyncore/dgram/base.py index cff98636..37510a80 100644 --- a/pysnmp/carrier/asyncore/dgram/base.py +++ b/pysnmp/carrier/asyncore/dgram/base.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # import socket diff --git a/pysnmp/carrier/asyncore/dgram/udp.py b/pysnmp/carrier/asyncore/dgram/udp.py index ed9a70e5..08ae5ceb 100644 --- a/pysnmp/carrier/asyncore/dgram/udp.py +++ b/pysnmp/carrier/asyncore/dgram/udp.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # from socket import AF_INET diff --git a/pysnmp/carrier/asyncore/dgram/udp6.py b/pysnmp/carrier/asyncore/dgram/udp6.py index 944048b7..900ef3c7 100644 --- a/pysnmp/carrier/asyncore/dgram/udp6.py +++ b/pysnmp/carrier/asyncore/dgram/udp6.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # from pysnmp.carrier import sockfix diff --git a/pysnmp/carrier/asyncore/dgram/unix.py b/pysnmp/carrier/asyncore/dgram/unix.py new file mode 100644 index 00000000..15f68b2b --- /dev/null +++ b/pysnmp/carrier/asyncore/dgram/unix.py @@ -0,0 +1,61 @@ +# +# This file is part of pysnmp software. +# +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> +# License: http://snmplabs.com/pysnmp/license.html +# +import os +import random + +try: + from socket import AF_UNIX +except ImportError: + AF_UNIX = None +from pysnmp.carrier.base import AbstractTransportAddress +from pysnmp.carrier.asyncore.dgram.base import DgramSocketTransport + +domainName = snmpLocalDomain = (1, 3, 6, 1, 2, 1, 100, 1, 13) + +random.seed() + + +class UnixTransportAddress(str, AbstractTransportAddress): + pass + + +class UnixSocketTransport(DgramSocketTransport): + sockFamily = AF_UNIX + addressType = UnixTransportAddress + _iface = '' + + def openClientMode(self, iface=None): + if iface is None: + # UNIX domain sockets must be explicitly bound + iface = '' + while len(iface) < 8: + iface += chr(random.randrange(65, 91)) + iface += chr(random.randrange(97, 123)) + iface = os.path.sep + 'tmp' + os.path.sep + 'pysnmp' + iface + if os.path.exists(iface): + os.remove(iface) + DgramSocketTransport.openClientMode(self, iface) + self._iface = iface + return self + + def openServerMode(self, iface): + DgramSocketTransport.openServerMode(self, iface) + self._iface = iface + return self + + def closeTransport(self): + DgramSocketTransport.closeTransport(self) + try: + os.remove(self._iface) + except OSError: + pass + + +UnixTransport = UnixSocketTransport + +# Compatibility stub +UnixDgramSocketTransport = UnixSocketTransport diff --git a/pysnmp/carrier/asyncore/dispatch.py b/pysnmp/carrier/asyncore/dispatch.py index 4cdd61bf..221c596c 100644 --- a/pysnmp/carrier/asyncore/dispatch.py +++ b/pysnmp/carrier/asyncore/dispatch.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # from time import time diff --git a/pysnmp/carrier/asynsock/dgram/udp.py b/pysnmp/carrier/asynsock/dgram/udp.py new file mode 100644 index 00000000..ab44b28f --- /dev/null +++ b/pysnmp/carrier/asynsock/dgram/udp.py @@ -0,0 +1,7 @@ +# +# This file is part of pysnmp software. +# +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> +# License: http://snmplabs.com/pysnmp/license.html +# +from pysnmp.carrier.asyncore.dgram.udp import * diff --git a/pysnmp/carrier/asynsock/dgram/udp6.py b/pysnmp/carrier/asynsock/dgram/udp6.py new file mode 100644 index 00000000..b3a8aec0 --- /dev/null +++ b/pysnmp/carrier/asynsock/dgram/udp6.py @@ -0,0 +1,7 @@ +# +# This file is part of pysnmp software. +# +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> +# License: http://snmplabs.com/pysnmp/license.html +# +from pysnmp.carrier.asyncore.dgram.udp6 import * diff --git a/pysnmp/carrier/asynsock/dgram/unix.py b/pysnmp/carrier/asynsock/dgram/unix.py new file mode 100644 index 00000000..887b4edb --- /dev/null +++ b/pysnmp/carrier/asynsock/dgram/unix.py @@ -0,0 +1,7 @@ +# +# This file is part of pysnmp software. +# +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> +# License: http://snmplabs.com/pysnmp/license.html +# +from pysnmp.carrier.asyncore.dgram.unix import * diff --git a/pysnmp/carrier/asynsock/dispatch.py b/pysnmp/carrier/asynsock/dispatch.py new file mode 100644 index 00000000..478d9e49 --- /dev/null +++ b/pysnmp/carrier/asynsock/dispatch.py @@ -0,0 +1,9 @@ +# +# This file is part of pysnmp software. +# +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> +# License: http://snmplabs.com/pysnmp/license.html +# +from pysnmp.carrier.asyncore.dispatch import * + +AsynsockDispatcher = AsyncoreDispatcher diff --git a/pysnmp/carrier/base.py b/pysnmp/carrier/base.py index ef6485c0..017a1520 100644 --- a/pysnmp/carrier/base.py +++ b/pysnmp/carrier/base.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # from pysnmp.carrier import error diff --git a/pysnmp/carrier/error.py b/pysnmp/carrier/error.py index 601fd0ee..34d1add2 100644 --- a/pysnmp/carrier/error.py +++ b/pysnmp/carrier/error.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # from pysnmp import error diff --git a/pysnmp/carrier/sockfix.py b/pysnmp/carrier/sockfix.py index 01b69223..d4ea504e 100644 --- a/pysnmp/carrier/sockfix.py +++ b/pysnmp/carrier/sockfix.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # import socket diff --git a/pysnmp/carrier/sockmsg.py b/pysnmp/carrier/sockmsg.py index 634ea187..0d79b2c7 100644 --- a/pysnmp/carrier/sockmsg.py +++ b/pysnmp/carrier/sockmsg.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # # The following routines act like sendto()/recvfrom() calls but additionally diff --git a/pysnmp/carrier/twisted/base.py b/pysnmp/carrier/twisted/base.py index f7d0f306..d8b75bc7 100644 --- a/pysnmp/carrier/twisted/base.py +++ b/pysnmp/carrier/twisted/base.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # # Copyright (C) 2008 Truelite Srl <info@truelite.it> diff --git a/pysnmp/carrier/twisted/dgram/base.py b/pysnmp/carrier/twisted/dgram/base.py index 7df96d93..4995aec4 100644 --- a/pysnmp/carrier/twisted/dgram/base.py +++ b/pysnmp/carrier/twisted/dgram/base.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # import sys diff --git a/pysnmp/carrier/twisted/dgram/udp.py b/pysnmp/carrier/twisted/dgram/udp.py index 1eaf8636..ac0f23f1 100644 --- a/pysnmp/carrier/twisted/dgram/udp.py +++ b/pysnmp/carrier/twisted/dgram/udp.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # import sys diff --git a/pysnmp/carrier/twisted/dgram/unix.py b/pysnmp/carrier/twisted/dgram/unix.py new file mode 100644 index 00000000..a256969c --- /dev/null +++ b/pysnmp/carrier/twisted/dgram/unix.py @@ -0,0 +1,46 @@ +# +# This file is part of pysnmp software. +# +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> +# License: http://snmplabs.com/pysnmp/license.html +# +import sys +from twisted.internet import reactor +from pysnmp.carrier.base import AbstractTransportAddress +from pysnmp.carrier.twisted.dgram.base import DgramTwistedTransport +from pysnmp.carrier import error + +domainName = snmpLocalDomain = (1, 3, 6, 1, 2, 1, 100, 1, 13) + +class UnixTransportAddress(str, AbstractTransportAddress): + pass + +class UnixTwistedTransport(DgramTwistedTransport): + addressType = UnixTransportAddress + _lport = None + + # AbstractTwistedTransport API + + def openClientMode(self, iface=''): + try: + self._lport = reactor.connectUNIXDatagram(iface, self) + except Exception: + raise error.CarrierError(sys.exc_info()[1]) + return self + + def openServerMode(self, iface): + try: + self._lport = reactor.listenUNIXDatagram(iface, self) + except Exception: + raise error.CarrierError(sys.exc_info()[1]) + + return self + + def closeTransport(self): + if self._lport is not None: + d = self._lport.stopListening() + if d: + d.addCallback(lambda x: None) + DgramTwistedTransport.closeTransport(self) + +UnixTransport = UnixTwistedTransport diff --git a/pysnmp/carrier/twisted/dispatch.py b/pysnmp/carrier/twisted/dispatch.py index 5113e7b2..def16f6f 100644 --- a/pysnmp/carrier/twisted/dispatch.py +++ b/pysnmp/carrier/twisted/dispatch.py @@ -1,7 +1,7 @@ # # This file is part of pysnmp software. # -# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> +# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # # Copyright (C) 2008 Truelite Srl <info@truelite.it> |