예제 #1
0
    def receiveControlMessage(self, opcode, args=None):
        """Do operation indicated by the _opcode."""
        log.debug("[wfpad - %s] Received control message with opcode %s and args: %s",
                  self.end, mes.getOpcodeNames(opcode), args)

        if self.weAreServer:
            # Generic primitives
            if opcode == const.OP_SEND_PADDING:
                self.relaySendPadding(*args)
            elif opcode == const.OP_APP_HINT:
                self.relayAppHint(*args)

            # Adaptive padding primitives
            elif opcode == const.OP_BURST_HISTO:
                self.relayBurstHistogram(*args)
            elif opcode == const.OP_GAP_HISTO:
                self.relayGapHistogram(*args)

            # CS-BuFLO primitives
            elif opcode == const.OP_TOTAL_PAD:
                self.relayTotalPad(*args)
            elif opcode == const.OP_PAYLOAD_PAD:
                self.relayPayloadPad(*args)

            # Tamaraw primitives
            elif opcode == const.OP_BATCH_PAD:
                self.relayBatchPad(*args)

            # Walkie-Talkie primitives
            elif opcode == const.OP_WT_PAGE_ID:
                self.relayPageID(*args)
            elif opcode == const.OP_WT_BURST_END:
                self.relayEndBurst(*args)
            elif opcode == const.OP_WT_TALKIE_START:
                self.relayTalkieStart(*args)

            else:
                Exception("Client cannot receive control messages with opcode %s." % opcode)

        else:
            # Walkie-Talkie primitives
            if opcode == const.OP_WT_BURST_END:
                self.relayEndBurst(*args)

        # TODO: review. We are making the assumption that the session will always
        # start by a request sent by the client and it will end by a response sent
        # by the server...
        if opcode == const.OP_END_PADDING:
            self.relayEndPadding(*args)
        else:
            Exception("Unknown opcode message: %s." % opcode)
예제 #2
0
    def receiveControlMessage(self, opcode, args=None):
        """Do operation indicated by the _opcode."""
        log.debug("[wfpad - %s] Received control message with opcode %s and args: %s",
                  self.end, mes.getOpcodeNames(opcode), args)

        if self.weAreServer:
            # Generic primitives
            if opcode == const.OP_SEND_PADDING:
                self.relaySendPadding(*args)
            elif opcode == const.OP_APP_HINT:
                self.relayAppHint(*args)

            # Adaptive padding primitives
            elif opcode == const.OP_BURST_HISTO:
                self.relayBurstHistogram(*args)
            elif opcode == const.OP_GAP_HISTO:
                self.relayGapHistogram(*args)

            # CS-BuFLO primitives
            elif opcode == const.OP_TOTAL_PAD:
                self.relayTotalPad(*args)
            elif opcode == const.OP_PAYLOAD_PAD:
                self.relayPayloadPad(*args)

            # Tamaraw primitives
            elif opcode == const.OP_BATCH_PAD:
                self.relayBatchPad(*args)
            else:
                Exception("Client cannot receive control messages with opcode %s." % opcode)

        else:
            pass

        # TODO: review. We are making the assumption that the session will always
        # start by a request sent by the client and it will end by a response sent
        # by the server...
        if opcode == const.OP_END_PADDING:
            self.relayEndPadding(*args)
        else:
            Exception("Unknown opcode message: %s." % opcode)
예제 #3
0
 def doWhileSession(self):
     """Send control msg."""
     log.debug("Sending to client the control instruction"
               " for control msg: %s", getOpcodeNames(self.opcode))
     self.send_instruction(self.opcode, self.args)
예제 #4
0
 def doWhileSession(self):
     """Send control msg."""
     log.debug(
         "Sending to client the control instruction"
         " for control msg: %s", getOpcodeNames(self.opcode))
     self.send_instruction(self.opcode, self.args)