mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
Clean up PortManager class, mark PortVal ctors deprecated.
Moved PortVal ctors back to public API, but deprecated, just in case it helps give any external code a chance to adapt.
This commit is contained in:
parent
054c4a67c4
commit
d6d7f33f5c
2 changed files with 36 additions and 14 deletions
21
src/Val.h
21
src/Val.h
|
@ -510,9 +510,15 @@ public:
|
|||
~PortManager();
|
||||
|
||||
// Port number given in host order.
|
||||
PortVal* Get(uint32 port_num) const;
|
||||
PortVal* Get(uint32 port_num, TransportProto port_type) const;
|
||||
|
||||
// Host-order port number already masked with port space protocol mask.
|
||||
PortVal* Get(uint32 port_num) const;
|
||||
|
||||
// Returns a masked port number
|
||||
uint32 Mask(uint32 port_num, TransportProto port_type) const;
|
||||
|
||||
private:
|
||||
std::array<std::array<PortVal*, 65536>, NUM_PORT_SPACES> ports;
|
||||
};
|
||||
|
||||
|
@ -520,6 +526,14 @@ extern PortManager* port_mgr;
|
|||
|
||||
class PortVal : public Val {
|
||||
public:
|
||||
// Port number given in host order.
|
||||
BRO_DEPRECATED("use port_mgr->Get() instead")
|
||||
PortVal(uint32 p, TransportProto port_type);
|
||||
|
||||
// Host-order port number already masked with port space protocol mask.
|
||||
BRO_DEPRECATED("use port_mgr->Get() instead")
|
||||
PortVal(uint32 p);
|
||||
|
||||
Val* SizeVal() const override { return new Val(val.uint_val, TYPE_INT); }
|
||||
|
||||
// Returns the port number in host order (not including the mask).
|
||||
|
@ -546,10 +560,7 @@ protected:
|
|||
friend class Val;
|
||||
friend class PortManager;
|
||||
PortVal() {}
|
||||
// Constructors - both take the port number in host order.
|
||||
PortVal(uint32 p, TransportProto port_type);
|
||||
PortVal(uint32 p); // used for already-massaged port value.
|
||||
|
||||
PortVal(uint32 p, bool unused);
|
||||
|
||||
void ValDescribe(ODesc* d) const override;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue