# Copyright 2026 SigmaSRC, Inc. All Rights Reserved.

# An interface to return netstat columns

class NetstatInfo(object):

    def __init__(self, proto, localip, localport,
                 foreignip, foreignport, state, pid, processName):
        self.proto = proto
        self.localip = localip
        self.localport = localport
        self.foreignip = foreignip
        self.foreignport = foreignport
        self.state = state
        self.pid = pid
        self.processName = processName

    def __eq__(self, other):
        return isinstance(other, NetstatInfo) and \
            self.proto == other.proto and \
            self.localip == other.localip and \
            self.localport == other.localport and \
            self.foreignip == other.foreignip and \
            self.foreignport == other.foreignport and \
            self.state == other.state and \
            self.pid == other.pid and \
            self.processName == other.processName

    def __ne__(self, other):
        return not self.__eq__(other)

    def __hash__(self):
        return hash((self.proto, self.localip, self.localport, 
        self.foreignip, self.foreignport, self.state, self.pid, self.processName))
