Example #1
0
    def __init__(self, config, api):

        imaging = PXEImagingApi(config)
        imaging.set_api(api)
        
        pxe_port = config.imaging_api["pxe_port"]

        udp = UDPProxy()
        udp.set_imaging(imaging)

        reactor.listenUDP(pxe_port, udp)

        tcp = Factory()
        tcp.protocol = TCPProxy
        tcp.protocol.set_imaging(imaging)

        reactor.listenTCP(pxe_port, tcp)
Example #2
0
    def process_data (self, data, client=None):
        """
        Called when a packet received.

        @param data: packet
        @type data: str

        @param client: client (host, port) tuple
        @type client: tuple
        """
        # For each session a new instance of PXEImagingApi created

        imaging = PXEImagingApi(self.config)
        imaging.set_api(self.api)

        fnc, args = imaging.get_method(data)

        d = self.method_exec(imaging, fnc, args)

        d.addCallback(self.send_response, fnc, client)
        d.addErrback(self.on_exec_error)

        return d
Example #3
0
File: server.py Project: inkhey/mmc
    def process_data (self, data, client=None):
        """
        Called when a packet received.

        @param data: packet
        @type data: str

        @param client: client (host, port) tuple
        @type client: tuple
        """
        # For each session a new instance of PXEImagingApi created

        imaging = PXEImagingApi(self.config)
        imaging.set_api(self.api)

        fnc, args = imaging.get_method(data)

        d = self.method_exec(imaging, fnc, args)

        d.addCallback(self.send_response, fnc, client)
        d.addErrback(self.on_exec_error)

        return d