コード例 #1
0
    def startSMPPServerService(self):
        "Start SMPP Server"

        SMPPServerConfigInstance = SMPPServerConfig(self.options['config'])

        # Set authentication portal
        p = portal.Portal(
            SmppsRealm(SMPPServerConfigInstance.id,
                       self.components['router-pb-factory']))
        p.registerChecker(
            RouterAuthChecker(self.components['router-pb-factory']))

        # SMPPServerFactory init
        self.components['smpp-server-factory'] = SMPPServerFactory(
            SMPPServerConfigInstance,
            auth_portal=p,
            RouterPB=self.components['router-pb-factory'],
            SMPPClientManagerPB=self.components['smppcm-pb-factory'])

        # Start server
        self.components['smpp-server'] = reactor.listenTCP(
            SMPPServerConfigInstance.port,
            self.components['smpp-server-factory'],
            interface=SMPPServerConfigInstance.bind)

        # Add interceptor if enabled:
        if 'interceptor-pb-client' in self.components:
            self.components['smpp-server-factory'].addInterceptorPBClient(
                self.components['interceptor-pb-client'])
コード例 #2
0
    def setUp(self):
        # Launch AMQP Broker
        AMQPServiceConfigInstance = AmqpConfig()
        AMQPServiceConfigInstance.reconnectOnConnectionLoss = False
        self.amqpBroker = AmqpFactory(AMQPServiceConfigInstance)
        self.amqpBroker.preConnect()
        self.amqpClient = reactor.connectTCP(AMQPServiceConfigInstance.host, AMQPServiceConfigInstance.port,
                                             self.amqpBroker)

        # Wait for AMQP Broker connection to get ready
        yield self.amqpBroker.getChannelReadyDeferred()

        # Instanciate a RouterPB (a requirement for JCliFactory)
        self.RouterPBConfigInstance = RouterPBConfig()
        self.RouterPBConfigInstance.authentication = False
        self.RouterPB_f = RouterPB(self.RouterPBConfigInstance)

        # Instanciate a SMPPClientManagerPB (a requirement for JCliFactory)
        SMPPClientPBConfigInstance = SMPPClientPBConfig()
        SMPPClientPBConfigInstance.authentication = False
        self.clientManager_f = SMPPClientManagerPB(SMPPClientPBConfigInstance)
        yield self.clientManager_f.addAmqpBroker(self.amqpBroker)

        # Instanciate a SMPPServerFactory (a requirement for JCliFactory)
        SMPPServerConfigInstance = SMPPServerConfig()

        # Portal init
        _portal = portal.Portal(SmppsRealm(SMPPServerConfigInstance.id, self.RouterPB_f))
        _portal.registerChecker(RouterAuthChecker(self.RouterPB_f))

        self.SMPPSFactory = SMPPServerFactory(
            config=SMPPServerConfigInstance,
            auth_portal=_portal,
            RouterPB=self.RouterPB_f,
            SMPPClientManagerPB=self.clientManager_f)
コード例 #3
0
ファイル: test_router_smpps.py プロジェクト: AVert/jasmin
 def buildProtocol(self, addr):
     self.lastProto = SMPPServerFactory.buildProtocol(self, addr)
     return self.lastProto
コード例 #4
0
 def buildProtocol(self, addr):
     self.lastProto = SMPPServerFactory.buildProtocol(self, addr)
     return self.lastProto