예제 #1
0
def test_basic_roapdus_parsing():
    data = "\x00\x01\x00\x00"  # PIPG-291

    r = intellivue.ROapdus()
    r.dissect(data)

    assert r.ro_type == intellivue.ROIV_APDU
예제 #2
0
    def handleProtocolMessage(self, data, addr):
        log.debug("Received Protocol message, handling")
        message = packets.SPpdu()
        message.dissect(data)

        self.logPacket(message)

        host, _ = addr

        if packets.ROIVapdu in message:
            roivapdu = message[packets.ROIVapdu]

            if roivapdu.command_type == packets.CMD_CONFIRMED_EVENT_REPORT:
                log.info(
                    "Received MDSCreateEventReport, sending MDSCreateEventResult",
                    addr=addr)

                # Ok! Now to reply!

                mdsceResult = packets.SPpdu()
                mdsceResult = mdsceResult / packets.ROapdus(
                    ro_type=packets.RORS_APDU)
                mdsceResult = mdsceResult / packets.RORSapdu(
                    command_type=packets.CMD_CONFIRMED_EVENT_REPORT,
                    invoke_id=message[packets.ROIVapdu].invoke_id,
                )
                mdsceResult = mdsceResult / packets.EventReportResult(
                    managed_object=message[
                        packets.EventReportArgument].managed_object,
                    event_type=packets.NOM_NOTI_MDS_CREAT,
                )

                self.transport.write(str(mdsceResult), addr)

                self.connections.add(host)
            else:
                log.warning("Unknown command_type in roivapdu!",
                            addr=addr,
                            roivapdu=roivapdu)
                roivapdu.show()
        elif packets.ROLRSapdu in message:
            # TODO Implement support for rolling up Remote Operation Linked Results
            log.debug("ROLRSapdu!")
            # message.show()
            self.handleResult(host, message)
        elif packets.ROERapdu in message:
            # Error
            message[packets.ROERapdu].show()
        elif packets.RORSapdu in message:
            log.debug("Results!")
            # message.show()
            self.handleResult(host, message)
        else:
            log.warning("Unknown message!")
            message.show()
예제 #3
0
    def pollForData(self, addr):
        pollAction = packets.SPpdu()  # PIPG-55
        pollAction /= packets.ROapdus(ro_type=packets.ROIV_APDU)
        pollAction /= packets.ROIVapdu(
            command_type=packets.CMD_CONFIRMED_ACTION)
        pollAction /= packets.ActionArgument(
            managed_object=packets.ManagedObjectId(
                m_obj_class=packets.NOM_MOC_VMS_MDS),
            action_type=packets.NOM_ACT_POLL_MDIB_DATA_EXT,
        )
        pollAction /= packets.PollMdibDataReqExt(
            polled_obj_type=packets.TYPE(
                partition=packets.NOM_PART_OBJ,
                code=packets.
                NOM_MOC_VMO_METRIC_NU,  # Numerics, i.e. numbers about attached patient
            ),
            polled_attr_grp=packets.
            NOM_ATTR_GRP_METRIC_VAL_OBS,  # Observed values of the "object" (patient)
        )

        # pollAction.show2()

        self.transport.write(str(pollAction), addr)