NetworkConfig.hpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. /*
  2. * Copyright (c)2019 ZeroTier, Inc.
  3. *
  4. * Use of this software is governed by the Business Source License included
  5. * in the LICENSE.TXT file in the project's root directory.
  6. *
  7. * Change Date: 2023-01-01
  8. *
  9. * On the date above, in accordance with the Business Source License, use
  10. * of this software will be governed by version 2.0 of the Apache License.
  11. */
  12. /****/
  13. #ifndef ZT_NETWORKCONFIG_HPP
  14. #define ZT_NETWORKCONFIG_HPP
  15. #include <stdint.h>
  16. #include <string.h>
  17. #include <stdlib.h>
  18. #include <vector>
  19. #include <stdexcept>
  20. #include <algorithm>
  21. #include "../include/ZeroTierOne.h"
  22. #include "Constants.hpp"
  23. #include "Buffer.hpp"
  24. #include "InetAddress.hpp"
  25. #include "MulticastGroup.hpp"
  26. #include "Address.hpp"
  27. #include "CertificateOfMembership.hpp"
  28. #include "CertificateOfOwnership.hpp"
  29. #include "Capability.hpp"
  30. #include "Tag.hpp"
  31. #include "Dictionary.hpp"
  32. #include "Hashtable.hpp"
  33. #include "Identity.hpp"
  34. #include "Utils.hpp"
  35. #include "Trace.hpp"
  36. /**
  37. * Default maximum time delta for COMs, tags, and capabilities
  38. *
  39. * The current value is two hours, providing ample time for a controller to
  40. * experience fail-over, etc.
  41. */
  42. #define ZT_NETWORKCONFIG_DEFAULT_CREDENTIAL_TIME_MAX_MAX_DELTA 7200000ULL
  43. /**
  44. * Default minimum credential TTL and maxDelta for COM timestamps
  45. *
  46. * This is just slightly over three minutes and provides three retries for
  47. * all currently online members to refresh.
  48. */
  49. #define ZT_NETWORKCONFIG_DEFAULT_CREDENTIAL_TIME_MIN_MAX_DELTA 185000ULL
  50. /**
  51. * Flag: enable broadcast
  52. */
  53. #define ZT_NETWORKCONFIG_FLAG_ENABLE_BROADCAST 0x0000000000000002ULL
  54. /**
  55. * Flag: enable IPv6 NDP emulation for certain V6 address patterns
  56. */
  57. #define ZT_NETWORKCONFIG_FLAG_ENABLE_IPV6_NDP_EMULATION 0x0000000000000004ULL
  58. /**
  59. * Flag: result of unrecognized MATCH entries in a rules table: match if set, no-match if clear
  60. */
  61. #define ZT_NETWORKCONFIG_FLAG_RULES_RESULT_OF_UNSUPPORTED_MATCH 0x0000000000000008ULL
  62. /**
  63. * Flag: disable frame compression
  64. */
  65. #define ZT_NETWORKCONFIG_FLAG_DISABLE_COMPRESSION 0x0000000000000010ULL
  66. /**
  67. * Device can bridge to other Ethernet networks and gets unknown recipient multicasts
  68. */
  69. #define ZT_NETWORKCONFIG_SPECIALIST_TYPE_ACTIVE_BRIDGE 0x0000020000000000ULL
  70. /**
  71. * Anchors are stable devices on this network that can act like roots when none are up
  72. */
  73. #define ZT_NETWORKCONFIG_SPECIALIST_TYPE_ANCHOR 0x0000040000000000ULL
  74. /**
  75. * Designated multicast replicators replicate multicast in place of sender-side replication
  76. */
  77. #define ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR 0x0000080000000000ULL
  78. namespace ZeroTier {
  79. // Dictionary capacity needed for max size network config
  80. #define ZT_NETWORKCONFIG_DICT_CAPACITY (1024 + (sizeof(ZT_VirtualNetworkRule) * ZT_MAX_NETWORK_RULES) + (sizeof(Capability) * ZT_MAX_NETWORK_CAPABILITIES) + (sizeof(Tag) * ZT_MAX_NETWORK_TAGS) + (sizeof(CertificateOfOwnership) * ZT_MAX_CERTIFICATES_OF_OWNERSHIP))
  81. // Dictionary capacity needed for max size network meta-data
  82. #define ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY 1024
  83. // Network config version
  84. #define ZT_NETWORKCONFIG_VERSION 7
  85. // Fields for meta-data sent with network config requests
  86. // Network config version
  87. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_VERSION "v"
  88. // Protocol version (see Packet.hpp)
  89. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_PROTOCOL_VERSION "pv"
  90. // Software vendor
  91. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_NODE_VENDOR "vend"
  92. // Software major version
  93. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_NODE_MAJOR_VERSION "majv"
  94. // Software minor version
  95. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_NODE_MINOR_VERSION "minv"
  96. // Software revision
  97. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_NODE_REVISION "revv"
  98. // Rules engine revision
  99. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_RULES_ENGINE_REV "revr"
  100. // Maximum number of rules per network this node can accept
  101. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_MAX_NETWORK_RULES "mr"
  102. // Maximum number of capabilities this node can accept
  103. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_MAX_NETWORK_CAPABILITIES "mc"
  104. // Maximum number of rules per capability this node can accept
  105. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_MAX_CAPABILITY_RULES "mcr"
  106. // Maximum number of tags this node can accept
  107. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_MAX_NETWORK_TAGS "mt"
  108. // Network join authorization token (if any)
  109. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_AUTH "a"
  110. // Network configuration meta-data flags
  111. #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_FLAGS "f"
  112. // These dictionary keys are short so they don't take up much room.
  113. // By convention we use upper case for binary blobs, but it doesn't really matter.
  114. // network config version
  115. #define ZT_NETWORKCONFIG_DICT_KEY_VERSION "v"
  116. // network ID
  117. #define ZT_NETWORKCONFIG_DICT_KEY_NETWORK_ID "nwid"
  118. // integer(hex)
  119. #define ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP "ts"
  120. // integer(hex)
  121. #define ZT_NETWORKCONFIG_DICT_KEY_REVISION "r"
  122. // address of member
  123. #define ZT_NETWORKCONFIG_DICT_KEY_ISSUED_TO "id"
  124. // remote trace target
  125. #define ZT_NETWORKCONFIG_DICT_KEY_REMOTE_TRACE_TARGET "tt"
  126. // remote trace level
  127. #define ZT_NETWORKCONFIG_DICT_KEY_REMOTE_TRACE_LEVEL "tl"
  128. // flags(hex)
  129. #define ZT_NETWORKCONFIG_DICT_KEY_FLAGS "f"
  130. // integer(hex)
  131. #define ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_LIMIT "ml"
  132. // network type (hex)
  133. #define ZT_NETWORKCONFIG_DICT_KEY_TYPE "t"
  134. // text
  135. #define ZT_NETWORKCONFIG_DICT_KEY_NAME "n"
  136. // network MTU
  137. #define ZT_NETWORKCONFIG_DICT_KEY_MTU "mtu"
  138. // credential time max delta in ms
  139. #define ZT_NETWORKCONFIG_DICT_KEY_CREDENTIAL_TIME_MAX_DELTA "ctmd"
  140. // binary serialized certificate of membership
  141. #define ZT_NETWORKCONFIG_DICT_KEY_COM "C"
  142. // specialists (binary array of uint64_t)
  143. #define ZT_NETWORKCONFIG_DICT_KEY_SPECIALISTS "S"
  144. // routes (binary blob)
  145. #define ZT_NETWORKCONFIG_DICT_KEY_ROUTES "RT"
  146. // static IPs (binary blob)
  147. #define ZT_NETWORKCONFIG_DICT_KEY_STATIC_IPS "I"
  148. // rules (binary blob)
  149. #define ZT_NETWORKCONFIG_DICT_KEY_RULES "R"
  150. // capabilities (binary blobs)
  151. #define ZT_NETWORKCONFIG_DICT_KEY_CAPABILITIES "CAP"
  152. // tags (binary blobs)
  153. #define ZT_NETWORKCONFIG_DICT_KEY_TAGS "TAG"
  154. // tags (binary blobs)
  155. #define ZT_NETWORKCONFIG_DICT_KEY_CERTIFICATES_OF_OWNERSHIP "COO"
  156. // Legacy fields -- these are obsoleted but are included when older clients query
  157. // boolean (now a flag)
  158. #define ZT_NETWORKCONFIG_DICT_KEY_ENABLE_BROADCAST_OLD "eb"
  159. // IP/bits[,IP/bits,...]
  160. // Note that IPs that end in all zeroes are routes with no assignment in them.
  161. #define ZT_NETWORKCONFIG_DICT_KEY_IPV4_STATIC_OLD "v4s"
  162. // IP/bits[,IP/bits,...]
  163. // Note that IPs that end in all zeroes are routes with no assignment in them.
  164. #define ZT_NETWORKCONFIG_DICT_KEY_IPV6_STATIC_OLD "v6s"
  165. // 0/1
  166. #define ZT_NETWORKCONFIG_DICT_KEY_PRIVATE_OLD "p"
  167. // integer(hex)[,integer(hex),...]
  168. #define ZT_NETWORKCONFIG_DICT_KEY_ALLOWED_ETHERNET_TYPES_OLD "et"
  169. // string-serialized CertificateOfMembership
  170. #define ZT_NETWORKCONFIG_DICT_KEY_CERTIFICATE_OF_MEMBERSHIP_OLD "com"
  171. // node[,node,...]
  172. #define ZT_NETWORKCONFIG_DICT_KEY_ACTIVE_BRIDGES_OLD "ab"
  173. // node;IP/port[,node;IP/port]
  174. #define ZT_NETWORKCONFIG_DICT_KEY_RELAYS_OLD "rl"
  175. // End legacy fields
  176. /**
  177. * Network configuration received from network controller nodes
  178. *
  179. * This is a memcpy()'able structure and is safe (in a crash sense) to modify
  180. * without locks.
  181. */
  182. class NetworkConfig
  183. {
  184. public:
  185. NetworkConfig() :
  186. networkId(0),
  187. timestamp(0),
  188. credentialTimeMaxDelta(0),
  189. revision(0),
  190. issuedTo(),
  191. remoteTraceTarget(),
  192. flags(0),
  193. remoteTraceLevel(Trace::LEVEL_NORMAL),
  194. mtu(0),
  195. multicastLimit(0),
  196. specialistCount(0),
  197. routeCount(0),
  198. staticIpCount(0),
  199. ruleCount(0),
  200. capabilityCount(0),
  201. tagCount(0),
  202. certificateOfOwnershipCount(0),
  203. capabilities(),
  204. tags(),
  205. certificatesOfOwnership(),
  206. type(ZT_NETWORK_TYPE_PRIVATE)
  207. {
  208. name[0] = 0;
  209. memset(specialists, 0, sizeof(uint64_t)*ZT_MAX_NETWORK_SPECIALISTS);
  210. memset(routes, 0, sizeof(ZT_VirtualNetworkRoute)*ZT_MAX_NETWORK_ROUTES);
  211. memset(staticIps, 0, sizeof(InetAddress)*ZT_MAX_ZT_ASSIGNED_ADDRESSES);
  212. memset(rules, 0, sizeof(ZT_VirtualNetworkRule)*ZT_MAX_NETWORK_RULES);
  213. }
  214. /**
  215. * Write this network config to a dictionary for transport
  216. *
  217. * @param d Dictionary
  218. * @param includeLegacy If true, include legacy fields for old node versions
  219. * @return True if dictionary was successfully created, false if e.g. overflow
  220. */
  221. bool toDictionary(Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY> &d,bool includeLegacy) const;
  222. /**
  223. * Read this network config from a dictionary
  224. *
  225. * @param d Dictionary (non-const since it might be modified during parse, should not be used after call)
  226. * @return True if dictionary was valid and network config successfully initialized
  227. */
  228. bool fromDictionary(const Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY> &d);
  229. /**
  230. * @return True if broadcast (ff:ff:ff:ff:ff:ff) address should work on this network
  231. */
  232. inline bool enableBroadcast() const { return ((this->flags & ZT_NETWORKCONFIG_FLAG_ENABLE_BROADCAST) != 0); }
  233. /**
  234. * @return True if IPv6 NDP emulation should be allowed for certain "magic" IPv6 address patterns
  235. */
  236. inline bool ndpEmulation() const { return ((this->flags & ZT_NETWORKCONFIG_FLAG_ENABLE_IPV6_NDP_EMULATION) != 0); }
  237. /**
  238. * @return True if frames should not be compressed
  239. */
  240. inline bool disableCompression() const
  241. {
  242. #ifndef ZT_DISABLE_COMPRESSION
  243. return ((this->flags & ZT_NETWORKCONFIG_FLAG_DISABLE_COMPRESSION) != 0);
  244. #else
  245. /* Compression is disabled for libzt builds since it causes non-obvious chaotic
  246. interference with lwIP's TCP congestion algorithm. Compression is also disabled
  247. for some NAS builds due to the usage of low-performance processors in certain
  248. older and budget models. */
  249. return false;
  250. #endif
  251. }
  252. /**
  253. * @return Network type is public (no access control)
  254. */
  255. inline bool isPublic() const { return (this->type == ZT_NETWORK_TYPE_PUBLIC); }
  256. /**
  257. * @return Network type is private (certificate access control)
  258. */
  259. inline bool isPrivate() const { return (this->type == ZT_NETWORK_TYPE_PRIVATE); }
  260. /**
  261. * @return ZeroTier addresses of devices on this network designated as active bridges
  262. */
  263. inline std::vector<Address> activeBridges() const
  264. {
  265. std::vector<Address> r;
  266. for(unsigned int i=0;i<specialistCount;++i) {
  267. if ((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_ACTIVE_BRIDGE) != 0)
  268. r.push_back(Address(specialists[i]));
  269. }
  270. return r;
  271. }
  272. inline unsigned int activeBridges(Address ab[ZT_MAX_NETWORK_SPECIALISTS]) const
  273. {
  274. unsigned int c = 0;
  275. for(unsigned int i=0;i<specialistCount;++i) {
  276. if ((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_ACTIVE_BRIDGE) != 0)
  277. ab[c++] = specialists[i];
  278. }
  279. return c;
  280. }
  281. inline bool isActiveBridge(const Address &a) const
  282. {
  283. for(unsigned int i=0;i<specialistCount;++i) {
  284. if (((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_ACTIVE_BRIDGE) != 0)&&(a == specialists[i]))
  285. return true;
  286. }
  287. return false;
  288. }
  289. inline std::vector<Address> anchors() const
  290. {
  291. std::vector<Address> r;
  292. for(unsigned int i=0;i<specialistCount;++i) {
  293. if ((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_ANCHOR) != 0)
  294. r.push_back(Address(specialists[i]));
  295. }
  296. return r;
  297. }
  298. inline std::vector<Address> multicastReplicators() const
  299. {
  300. std::vector<Address> r;
  301. for(unsigned int i=0;i<specialistCount;++i) {
  302. if ((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR) != 0)
  303. r.push_back(Address(specialists[i]));
  304. }
  305. return r;
  306. }
  307. inline unsigned int multicastReplicators(Address mr[ZT_MAX_NETWORK_SPECIALISTS]) const
  308. {
  309. unsigned int c = 0;
  310. for(unsigned int i=0;i<specialistCount;++i) {
  311. if ((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR) != 0)
  312. mr[c++] = specialists[i];
  313. }
  314. return c;
  315. }
  316. inline bool isMulticastReplicator(const Address &a) const
  317. {
  318. for(unsigned int i=0;i<specialistCount;++i) {
  319. if (((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR) != 0)&&(a == specialists[i]))
  320. return true;
  321. }
  322. return false;
  323. }
  324. inline std::vector<Address> alwaysContactAddresses() const
  325. {
  326. std::vector<Address> r;
  327. for(unsigned int i=0;i<specialistCount;++i) {
  328. if ((specialists[i] & (ZT_NETWORKCONFIG_SPECIALIST_TYPE_ANCHOR | ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR)) != 0)
  329. r.push_back(Address(specialists[i]));
  330. }
  331. return r;
  332. }
  333. inline unsigned int alwaysContactAddresses(Address ac[ZT_MAX_NETWORK_SPECIALISTS]) const
  334. {
  335. unsigned int c = 0;
  336. for(unsigned int i=0;i<specialistCount;++i) {
  337. if ((specialists[i] & (ZT_NETWORKCONFIG_SPECIALIST_TYPE_ANCHOR | ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR)) != 0)
  338. ac[c++] = specialists[i];
  339. }
  340. return c;
  341. }
  342. inline void alwaysContactAddresses(Hashtable< Address,std::vector<InetAddress> > &a) const
  343. {
  344. for(unsigned int i=0;i<specialistCount;++i) {
  345. if ((specialists[i] & (ZT_NETWORKCONFIG_SPECIALIST_TYPE_ANCHOR | ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR)) != 0) {
  346. a[Address(specialists[i])];
  347. }
  348. }
  349. }
  350. /**
  351. * @param fromPeer Peer attempting to bridge other Ethernet peers onto network
  352. * @return True if this network allows bridging
  353. */
  354. inline bool permitsBridging(const Address &fromPeer) const
  355. {
  356. for(unsigned int i=0;i<specialistCount;++i) {
  357. if ((fromPeer == specialists[i])&&((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_ACTIVE_BRIDGE) != 0))
  358. return true;
  359. }
  360. return false;
  361. }
  362. inline operator bool() const { return (networkId != 0); }
  363. inline bool operator==(const NetworkConfig &nc) const { return (memcmp(this,&nc,sizeof(NetworkConfig)) == 0); }
  364. inline bool operator!=(const NetworkConfig &nc) const { return (!(*this == nc)); }
  365. /**
  366. * Add a specialist or mask flags if already present
  367. *
  368. * This masks the existing flags if the specialist is already here or adds
  369. * it otherwise.
  370. *
  371. * @param a Address of specialist
  372. * @param f Flags (OR of specialist role/type flags)
  373. * @return True if successfully masked or added
  374. */
  375. inline bool addSpecialist(const Address &a,const uint64_t f)
  376. {
  377. const uint64_t aint = a.toInt();
  378. for(unsigned int i=0;i<specialistCount;++i) {
  379. if ((specialists[i] & 0xffffffffffULL) == aint) {
  380. specialists[i] |= f;
  381. return true;
  382. }
  383. }
  384. if (specialistCount < ZT_MAX_NETWORK_SPECIALISTS) {
  385. specialists[specialistCount++] = f | aint;
  386. return true;
  387. }
  388. return false;
  389. }
  390. const Capability *capability(const uint32_t id) const
  391. {
  392. for(unsigned int i=0;i<capabilityCount;++i) {
  393. if (capabilities[i].id() == id)
  394. return &(capabilities[i]);
  395. }
  396. return (Capability *)0;
  397. }
  398. const Tag *tag(const uint32_t id) const
  399. {
  400. for(unsigned int i=0;i<tagCount;++i) {
  401. if (tags[i].id() == id)
  402. return &(tags[i]);
  403. }
  404. return (Tag *)0;
  405. }
  406. /**
  407. * Network ID that this configuration applies to
  408. */
  409. uint64_t networkId;
  410. /**
  411. * Controller-side time of config generation/issue
  412. */
  413. int64_t timestamp;
  414. /**
  415. * Max difference between timestamp and tag/capability timestamp
  416. */
  417. int64_t credentialTimeMaxDelta;
  418. /**
  419. * Controller-side revision counter for this configuration
  420. */
  421. uint64_t revision;
  422. /**
  423. * Address of device to which this config is issued
  424. */
  425. Address issuedTo;
  426. /**
  427. * If non-NULL, remote traces related to this network are sent here
  428. */
  429. Address remoteTraceTarget;
  430. /**
  431. * Flags (64-bit)
  432. */
  433. uint64_t flags;
  434. /**
  435. * Remote trace level
  436. */
  437. Trace::Level remoteTraceLevel;
  438. /**
  439. * Network MTU
  440. */
  441. unsigned int mtu;
  442. /**
  443. * Maximum number of recipients per multicast (not including active bridges)
  444. */
  445. unsigned int multicastLimit;
  446. /**
  447. * Number of specialists
  448. */
  449. unsigned int specialistCount;
  450. /**
  451. * Number of routes
  452. */
  453. unsigned int routeCount;
  454. /**
  455. * Number of ZT-managed static IP assignments
  456. */
  457. unsigned int staticIpCount;
  458. /**
  459. * Number of rule table entries
  460. */
  461. unsigned int ruleCount;
  462. /**
  463. * Number of capabilities
  464. */
  465. unsigned int capabilityCount;
  466. /**
  467. * Number of tags
  468. */
  469. unsigned int tagCount;
  470. /**
  471. * Number of certificates of ownership
  472. */
  473. unsigned int certificateOfOwnershipCount;
  474. /**
  475. * Specialist devices
  476. *
  477. * For each entry the least significant 40 bits are the device's ZeroTier
  478. * address and the most significant 24 bits are flags indicating its role.
  479. */
  480. uint64_t specialists[ZT_MAX_NETWORK_SPECIALISTS];
  481. /**
  482. * Statically defined "pushed" routes (including default gateways)
  483. */
  484. ZT_VirtualNetworkRoute routes[ZT_MAX_NETWORK_ROUTES];
  485. /**
  486. * Static IP assignments
  487. */
  488. InetAddress staticIps[ZT_MAX_ZT_ASSIGNED_ADDRESSES];
  489. /**
  490. * Base network rules
  491. */
  492. ZT_VirtualNetworkRule rules[ZT_MAX_NETWORK_RULES];
  493. /**
  494. * Capabilities for this node on this network, in ascending order of capability ID
  495. */
  496. Capability capabilities[ZT_MAX_NETWORK_CAPABILITIES];
  497. /**
  498. * Tags for this node on this network, in ascending order of tag ID
  499. */
  500. Tag tags[ZT_MAX_NETWORK_TAGS];
  501. /**
  502. * Certificates of ownership for this network member
  503. */
  504. CertificateOfOwnership certificatesOfOwnership[ZT_MAX_CERTIFICATES_OF_OWNERSHIP];
  505. /**
  506. * Network type (currently just public or private)
  507. */
  508. ZT_VirtualNetworkType type;
  509. /**
  510. * Network short name or empty string if not defined
  511. */
  512. char name[ZT_MAX_NETWORK_SHORT_NAME_LENGTH + 1];
  513. /**
  514. * Certificate of membership (for private networks)
  515. */
  516. CertificateOfMembership com;
  517. };
  518. } // namespace ZeroTier
  519. #endif