Spicy
port.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <hilti/ast/builder/type.h>
6 #include <hilti/ast/operators/common.h>
7 #include <hilti/ast/types/port.h>
8 
9 namespace hilti {
10 namespace operator_ {
11 
12 STANDARD_OPERATOR_2(port, Equal, type::Bool(), type::Port(), type::Port(), "Compares two port values.")
13 STANDARD_OPERATOR_2(port, Unequal, type::Bool(), type::Port(), type::Port(), "Compares two port values.")
14 
15 BEGIN_METHOD(port, Protocol)
16  auto signature() const {
17  return Signature{.self = type::Port(),
18  .result = builder::typeByID("hilti::Protocol"),
19  .id = "protocol",
20  .args = {},
21  .doc = R"(
22 Returns the protocol the port is using (such as UDP or TCP).
23 )"};
24  }
25 END_METHOD
26 
27 } // namespace operator_
28 } // namespace hilti