예제 #1
0
        BitField('c5_enabled', 0, 1),
        BitField('c4_enabled', 0, 1),
        BitField('c3_enabled', 0, 1),
        BitField('c2_enabled', 0, 1),
        BitField('c1_enabled', 0, 1),
        BitField('c0_enabled', 0, 1),
        ShortField('c0_pause_time', 0),
        ShortField('c1_pause_time', 0),
        ShortField('c2_pause_time', 0),
        ShortField('c3_pause_time', 0),
        ShortField('c4_pause_time', 0),
        ShortField('c5_pause_time', 0),
        ShortField('c6_pause_time', 0),
        ShortField('c7_pause_time', 0)
    ]


MAC_CTRL_CLASSES = {
    MACControl.OP_CODE_PAUSE: MACControlPause,
    MACControl.OP_CODE_GATE: MACControlGate,
    MACControl.OP_CODE_REPORT: MACControlReport,
    MACControl.OP_CODE_REGISTER_REQ: MACControlRegisterReq,
    MACControl.OP_CODE_REGISTER: MACControlRegister,
    MACControl.OP_CODE_REGISTER_ACK: MACControlRegisterAck,
    MACControl.OP_CODE_CLASS_BASED_FLOW_CONTROL:
    MACControlClassBasedFlowControl
}

bind_layers(Ether, MACControl, type=MAC_CONTROL_ETHER_TYPE)
bind_layers(Dot1Q, MACControl, type=MAC_CONTROL_ETHER_TYPE)
예제 #2
0
    """
    def __init__(self):
        self._strict_mode = True
        self.strict_mode_enable()

    def strict_mode_enable(self):
        """
        enable strict mode and dissector debugging
        """
        self._strict_mode = True
        conf.debug_dissector = True

    def strict_mode_disable(self):
        """
        disable strict mode and dissector debugging
        """
        self._strict_mode = False
        conf.debug_dissector = False

    def strict_mode(self):
        """
        get current strict mode state
        """
        return self._strict_mode


conf.contribs['LLDP'] = LLDPConfiguration()

bind_layers(Ether, LLDPDU, type=LLDP_ETHER_TYPE)
bind_layers(Dot1Q, LLDPDU, type=LLDP_ETHER_TYPE)
예제 #3
0
                                           type=self.type)) + pay + raw(pad)
        else:
            return raw(_EtherCatLengthCalc(length=self.length,
                                           type=self.type)) + pay

    def guess_payload_class(self, payload):
        try:
            dlpdu_type = payload[0]
            return EtherCat.ETHERCAT_TYPE12_DLPDU_TYPES[dlpdu_type]
        except KeyError:
            log_runtime.error('{}.guess_payload_class() - unknown or invalid '
                              'DLPDU type'.format(self.__class__.__name__))
            return Packet.guess_payload_class(self, payload)


bind_layers(Ether, EtherCat, type=0x88a4)
bind_layers(Dot1Q, EtherCat, type=0x88a4)

# bindings for DLPDUs

bind_layers(EtherCat, EtherCatAPRD, type=0x01)
bind_layers(EtherCat, EtherCatFPRD, type=0x01)
bind_layers(EtherCat, EtherCatBRD, type=0x01)
bind_layers(EtherCat, EtherCatLRD, type=0x01)
bind_layers(EtherCat, EtherCatAPWR, type=0x01)
bind_layers(EtherCat, EtherCatFPWR, type=0x01)
bind_layers(EtherCat, EtherCatBWR, type=0x01)
bind_layers(EtherCat, EtherCatLWR, type=0x01)
bind_layers(EtherCat, EtherCatAPRW, type=0x01)
bind_layers(EtherCat, EtherCatFPRW, type=0x01)
bind_layers(EtherCat, EtherCatBRW, type=0x01)
예제 #4
0
파일: lldp.py 프로젝트: 6WIND/scapy
    """
    def __init__(self):
        self._strict_mode = True
        self.strict_mode_enable()

    def strict_mode_enable(self):
        """
        enable strict mode and dissector debugging
        """
        self._strict_mode = True
        conf.debug_dissector = True

    def strict_mode_disable(self):
        """
        disable strict mode and dissector debugging
        """
        self._strict_mode = False
        conf.debug_dissector = False

    def strict_mode(self):
        """
        get current strict mode state
        """
        return self._strict_mode


conf.contribs['LLDP'] = LLDPConfiguration()

bind_layers(Ether, LLDPDU, type=LLDP_ETHER_TYPE)
bind_layers(Dot1Q, LLDPDU, type=LLDP_ETHER_TYPE)