29 lines
801 B
Python
29 lines
801 B
Python
from abc import ABC, abstractmethod
|
|
from typing import Dict, List, Any
|
|
from scapy.all import Packet
|
|
|
|
|
|
class FrameTypeInterface(ABC):
|
|
def __init__(self):
|
|
self.name: str = ""
|
|
self.frames_list = []
|
|
self.bytes = 0
|
|
|
|
def get_name(self):
|
|
"""Return the interface's name"""
|
|
return self.name
|
|
|
|
@abstractmethod
|
|
def add(self, timestamp: float, size: int, packet: Packet):
|
|
"""Add a packet to the statistics."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_summary_dict(self) -> Dict[str, Any]:
|
|
"""Return a dictionary of statistics for the tabular report."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_column_definitions(self) -> List[tuple]:
|
|
"""Return column definitions as [(column_name, format_spec), ...]"""
|
|
pass |