xref: /openbmc/slpd-lite/slp_meta.hpp (revision 20bab748)
1 #pragma once
2 
3 namespace slp
4 {
5 /** @brief SLP Version */
6 constexpr size_t VERSION_2 = 2;
7 constexpr auto SUCCESS = 0;
8 /** @brief SLP Port */
9 constexpr auto PORT = 427;
10 
11 constexpr auto TIMEOUT = 30;
12 /** @brief SLP service lifetime */
13 constexpr auto LIFETIME = 5;
14 
15 /** @brief Largest input or output buffer allowed */
16 constexpr size_t MAX_LEN = 255;
17 
18 /** @brief Defines the constants for slp header.
19  *  Size and the offsets.
20  */
21 namespace header
22 {
23 
24 constexpr size_t SIZE_VERSION = 1;
25 constexpr size_t SIZE_LENGTH = 1;
26 constexpr size_t SIZE_FLAGS = 2;
27 constexpr size_t SIZE_EXT = 3;
28 constexpr size_t SIZE_XID = 2;
29 constexpr size_t SIZE_LANG = 2;
30 
31 constexpr size_t OFFSET_VERSION = 0;
32 constexpr size_t OFFSET_FUNCTION = 1;
33 constexpr size_t OFFSET_LENGTH = 4;
34 constexpr size_t OFFSET_FLAGS = 5;
35 constexpr size_t OFFSET_EXT = 7;
36 constexpr size_t OFFSET_XID = 10;
37 constexpr size_t OFFSET_LANG_LEN = 12;
38 constexpr size_t OFFSET_LANG = 14;
39 
40 constexpr size_t MIN_LEN = 14;
41 } // namespace header
42 
43 /** @brief Defines the constants for slp response.
44  *  Size and the offsets.
45  */
46 
47 namespace response
48 {
49 
50 constexpr size_t SIZE_ERROR = 2;
51 constexpr size_t SIZE_SERVICE = 2;
52 constexpr size_t SIZE_URL_COUNT = 2;
53 constexpr size_t SIZE_URL_ENTRY = 6;
54 constexpr size_t SIZE_RESERVED = 1;
55 constexpr size_t SIZE_LIFETIME = 2;
56 constexpr size_t SIZE_URLLENGTH = 2;
57 constexpr size_t SIZE_AUTH = 1;
58 
59 constexpr size_t OFFSET_SERVICE_LEN = 18;
60 constexpr size_t OFFSET_SERVICE = 20;
61 constexpr size_t OFFSET_URL_ENTRY = 18;
62 
63 } // namespace response
64 
65 /** @brief Defines the constants for slp request.
66  *  Size and the offsets.
67  */
68 namespace request
69 {
70 
71 constexpr size_t MIN_SRVTYPE_LEN = 22;
72 constexpr size_t MIN_SRV_LEN = 24;
73 
74 constexpr size_t SIZE_PRLIST = 2;
75 constexpr size_t SIZE_NAMING = 2;
76 constexpr size_t SIZE_SCOPE = 2;
77 constexpr size_t SIZE_SERVICE_TYPE = 2;
78 constexpr size_t SIZE_PREDICATE = 2;
79 constexpr size_t SIZE_SLPI = 2;
80 
81 constexpr size_t OFFSET_PR_LEN = 16;
82 constexpr size_t OFFSET_PR = 18;
83 constexpr size_t OFFSET_SERVICE = 20;
84 
85 } // namespace request
86 } // namespace slp
87