Пример #1
0
    def _parse_raw_generic_interface_counters(self, unpacker: Unpacker):
        # Unpack Generic Interface Counters
        #     unsigned int ifIndex;
        #     unsigned int ifType;
        #     unsigned hyper ifSpeed;
        #     unsigned int ifDirection;      derived from MAU MIB (RFC 2668)
        #                                    0 = unkown, 1=full-duplex, 2=half-duplex,
        #                                    3 = in, 4=out
        #     unsigned int ifStatus;         bit field with the following bits assigned
        #                                    bit 0 = ifAdminStatus (0 = down, 1 = up)
        #                                    bit 1 = ifOperStatus (0 = down, 1 = up)
        #     unsigned hyper ifInOctets;
        #     unsigned int ifInUcastPkts;
        #     unsigned int ifInMulticastPkts;
        #     unsigned int ifInBroadcastPkts;
        #     unsigned int ifInDiscards;
        #     unsigned int ifInErrors;
        #     unsigned int ifInUnknownProtos;
        #     unsigned hyper ifOutOctets;
        #     unsigned int ifOutUcastPkts;
        #     unsigned int ifOutMulticastPkts;
        #     unsigned int ifOutBroadcastPkts;
        #     unsigned int ifOutDiscards;
        #     unsigned int ifOutErrors;
        #     unsigned int ifPromiscuousMode;

        self.if_index = unpacker.unpack_uint()
        self.if_type = unpacker.unpack_uint()
        self.if_speed = unpacker.unpack_uhyper()
        self.if_direction = unpacker.unpack_uint()
        self.if_status = unpacker.unpack_uint()
        self.if_in_octets = unpacker.unpack_uhyper()
        self.if_in_ucasts = unpacker.unpack_uint()
        self.if_in_mcasts = unpacker.unpack_uint()
        self.if_in_bcasts = unpacker.unpack_uint()
        self.if_in_discards = unpacker.unpack_uint()
        self.if_in_errors = unpacker.unpack_uint()
        self.if_in_unknown_protos = unpacker.unpack_uint()
        self.if_out_octets = unpacker.unpack_uhyper()
        self.if_out_ucasts = unpacker.unpack_uint()
        self.if_out_mcasts = unpacker.unpack_uint()
        self.if_out_bcasts = unpacker.unpack_uint()
        self.if_out_discards = unpacker.unpack_uint()
        self.if_out_errors = unpacker.unpack_uint()
        self.if_promiscuous_mode = unpacker.unpack_uint()
Пример #2
0
    def _parse_raw_generic_interface_counters(self, unpacker: Unpacker):
        # Unpack Generic Interface Counters
        #     unsigned int ifIndex;
        #     unsigned int ifType;
        #     unsigned hyper ifSpeed;
        #     unsigned int ifDirection;      derived from MAU MIB (RFC 2668)
        #                                    0 = unkown, 1=full-duplex, 2=half-duplex,
        #                                    3 = in, 4=out
        #     unsigned int ifStatus;         bit field with the following bits assigned
        #                                    bit 0 = ifAdminStatus (0 = down, 1 = up)
        #                                    bit 1 = ifOperStatus (0 = down, 1 = up)
        #     unsigned hyper ifInOctets;
        #     unsigned int ifInUcastPkts;
        #     unsigned int ifInMulticastPkts;
        #     unsigned int ifInBroadcastPkts;
        #     unsigned int ifInDiscards;
        #     unsigned int ifInErrors;
        #     unsigned int ifInUnknownProtos;
        #     unsigned hyper ifOutOctets;
        #     unsigned int ifOutUcastPkts;
        #     unsigned int ifOutMulticastPkts;
        #     unsigned int ifOutBroadcastPkts;
        #     unsigned int ifOutDiscards;
        #     unsigned int ifOutErrors;
        #     unsigned int ifPromiscuousMode;

        self.if_index = unpacker.unpack_uint()
        self.if_type = unpacker.unpack_uint()
        self.if_speed = unpacker.unpack_uhyper()
        self.if_direction = unpacker.unpack_uint()
        self.if_status = unpacker.unpack_uint()
        self.if_in_octets = unpacker.unpack_uhyper()
        self.if_in_ucasts = unpacker.unpack_uint()
        self.if_in_mcasts = unpacker.unpack_uint()
        self.if_in_bcasts = unpacker.unpack_uint()
        self.if_in_discards = unpacker.unpack_uint()
        self.if_in_errors = unpacker.unpack_uint()
        self.if_in_unknown_protos = unpacker.unpack_uint()
        self.if_out_octets = unpacker.unpack_uhyper()
        self.if_out_ucasts = unpacker.unpack_uint()
        self.if_out_mcasts = unpacker.unpack_uint()
        self.if_out_bcasts = unpacker.unpack_uint()
        self.if_out_discards = unpacker.unpack_uint()
        self.if_out_errors = unpacker.unpack_uint()
        self.if_promiscuous_mode = unpacker.unpack_uint()
Пример #3
0
 def unpack(unpacker: Unpacker) -> "int":
     return unpacker.unpack_uhyper()