%PDF- %PDF-
Direktori : /opt/plesk/python/2.7/lib/python2.7/site-packages/nmb/ |
Current File : //opt/plesk/python/2.7/lib/python2.7/site-packages/nmb/NetBIOS.pyc |
� �ac @ s� d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z m Z d d l m Z m Z m Z d e f d � � YZ d S( i����N( t NBNSt NotConnectedError( t TYPE_CLIENTt TYPE_SERVERt TYPE_WORKSTATIONt NetBIOSc B sk e Z e j d � Z e d d � Z d � Z d � Z d d d d � Z d d d � Z d � Z d � Z RS( s NMB.NetBIOSi c C so | | _ t j t j t j � | _ | j rL | j j t j t j d � n | rk | j j d | f � n d S( s| Instantiate a NetBIOS instance, and creates a IPv4 UDP socket to listen/send NBNS packets. :param boolean broadcast: A boolean flag to indicate if we should setup the listening UDP port in broadcast mode :param integer listen_port: Specifies the UDP port number to bind to for listening. If zero, OS will automatically select a free port number. i t N( t broadcastt sockett AF_INETt SOCK_DGRAMt sockt setsockoptt SOL_SOCKETt SO_BROADCASTt bind( t selfR t listen_port( ( s@ /opt/plesk/python/2.7/lib/python2.7/site-packages/nmb/NetBIOS.pyt __init__ s c C s | j j � d | _ d S( s� Close the underlying and free resources. The NetBIOS instance should not be used to perform any operations after this method returns. :return: None N( R t closet None( R ( ( s@ /opt/plesk/python/2.7/lib/python2.7/site-packages/nmb/NetBIOS.pyR s c C s2 | j s t d � � | j j | | | f � d S( Ns Socket is already closed( R t AssertionErrort sendto( R t datat ipt port( ( s@ /opt/plesk/python/2.7/lib/python2.7/site-packages/nmb/NetBIOS.pyt write# s R i� i c C s� | j s t d � � t j d d � } | j | | � } | j rR | rR d } n | sk | j j d � n | j | | | � | j | | � S( sc Send a query on the network and hopes that if machine matching the *name* will reply with its IP address. :param string ip: If the NBNSProtocol instance was instianted with broadcast=True, then this parameter can be an empty string. We will leave it to the OS to determine an appropriate broadcast address. If the NBNSProtocol instance was instianted with broadcast=False, then you should provide a target IP to send the query. :param integer port: The NetBIOS-NS port (IANA standard defines this port to be 137). You should not touch this parameter unless you know what you are doing. :param integer/float timeout: Number of seconds to wait for a reply, after which the method will return None :return: A list of IP addresses in dotted notation (aaa.bbb.ccc.ddd). On timeout, returns None. s Socket is already closedi i�� s <broadcast>sQ queryName: ip parameter is empty. OS might not transmit this query to the network( R R t randomt randintt prepareNameQueryR t logt warningR t _pollForNetBIOSPacket( R t nameR R t timeoutt trn_idR ( ( s@ /opt/plesk/python/2.7/lib/python2.7/site-packages/nmb/NetBIOS.pyt queryName'