How to use the netflow.ipfix.IPFIXSetHeader.size function in netflow

To help you get started, we’ve selected a few netflow examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitkeks / python-netflow-v9-softflowd / netflow / ipfix.py View on Github external
def __init__(self, data: bytes, templates):
        self.header = IPFIXSetHeader(data[0:IPFIXSetHeader.size])
        self.records = []
        self._templates = {}

        offset = IPFIXSetHeader.size
        if self.header.set_id == 2:  # template set
            while offset < self.header.length:  # length of whole set
                template_record = IPFIXTemplateRecord(data[offset:])
                self.records.append(template_record)
                if template_record.field_count == 0:
                    self._templates[template_record.template_id] = None
                else:
                    self._templates[template_record.template_id] = template_record.fields
                offset += template_record.get_length()

        elif self.header.set_id == 3:  # options template
            while offset < self.header.length:
                optionstemplate_record = IPFIXOptionsTemplateRecord(data[offset:])
                self.records.append(optionstemplate_record)
                if optionstemplate_record.field_count == 0:
                    self._templates[optionstemplate_record.template_id] = None
github bitkeks / python-netflow-v9-softflowd / netflow / ipfix.py View on Github external
def __init__(self, data: bytes, templates):
        self.header = IPFIXSetHeader(data[0:IPFIXSetHeader.size])
        self.records = []
        self._templates = {}

        offset = IPFIXSetHeader.size
        if self.header.set_id == 2:  # template set
            while offset < self.header.length:  # length of whole set
                template_record = IPFIXTemplateRecord(data[offset:])
                self.records.append(template_record)
                if template_record.field_count == 0:
                    self._templates[template_record.template_id] = None
                else:
                    self._templates[template_record.template_id] = template_record.fields
                offset += template_record.get_length()

        elif self.header.set_id == 3:  # options template
            while offset < self.header.length: