Event.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * ZeroTier One - Network Virtualization Everywhere
  3. * Copyright (C) 2011-2015 ZeroTier, Inc.
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. * --
  19. *
  20. * ZeroTier may be used and distributed under the terms of the GPLv3, which
  21. * are available at: http://www.gnu.org/licenses/gpl-3.0.html
  22. *
  23. * If you would like to embed ZeroTier into a commercial application or
  24. * redistribute it in a modified binary form, please contact ZeroTier Networks
  25. * LLC. Start here: http://www.zerotier.com/
  26. */
  27. package com.zerotierone.sdk;
  28. public enum Event {
  29. /**
  30. * Node has been initialized
  31. *
  32. * This is the first event generated, and is always sent. It may occur
  33. * before Node's constructor returns.
  34. */
  35. EVENT_UP,
  36. /**
  37. * Node is offline -- network does not seem to be reachable by any available strategy
  38. */
  39. EVENT_OFFLINE,
  40. /**
  41. * Node is online -- at least one upstream node appears reachable
  42. *
  43. * Meta-data: none
  44. */
  45. EVENT_ONLINE,
  46. /**
  47. * Node is shutting down
  48. *
  49. * <p>This is generated within Node's destructor when it is being shut down.
  50. * It's done for convenience, since cleaning up other state in the event
  51. * handler may appear more idiomatic.</p>
  52. */
  53. EVENT_DOWN,
  54. /**
  55. * Your identity has collided with another node's ZeroTier address
  56. *
  57. * <p>This happens if two different public keys both hash (via the algorithm
  58. * in Identity::generate()) to the same 40-bit ZeroTier address.</p>
  59. *
  60. * <p>This is something you should "never" see, where "never" is defined as
  61. * once per 2^39 new node initializations / identity creations. If you do
  62. * see it, you're going to see it very soon after a node is first
  63. * initialized.</p>
  64. *
  65. * <p>This is reported as an event rather than a return code since it's
  66. * detected asynchronously via error messages from authoritative nodes.</p>
  67. *
  68. * <p>If this occurs, you must shut down and delete the node, delete the
  69. * identity.secret record/file from the data store, and restart to generate
  70. * a new identity. If you don't do this, you will not be able to communicate
  71. * with other nodes.</p>
  72. *
  73. * <p>We'd automate this process, but we don't think silently deleting
  74. * private keys or changing our address without telling the calling code
  75. * is good form. It violates the principle of least surprise.</p>
  76. *
  77. * <p>You can technically get away with not handling this, but we recommend
  78. * doing so in a mature reliable application. Besides, handling this
  79. * condition is a good way to make sure it never arises. It's like how
  80. * umbrellas prevent rain and smoke detectors prevent fires. They do, right?</p>
  81. */
  82. EVENT_FATAL_ERROR_IDENTITY_COLLISION,
  83. /**
  84. * A more recent version was observed on the network
  85. *
  86. * <p>Right now this is only triggered if a hub or supernode reports a
  87. * more recent version, and only once. It can be used to trigger a
  88. * software update check.</p>
  89. *
  90. * <p>Meta-data: {@link Version}, more recent version number</p>
  91. */
  92. EVENT_SAW_MORE_RECENT_VERSION,
  93. /**
  94. * A packet failed authentication
  95. *
  96. * <p>Meta-data: {@link InetSocketAddress} containing origin address of packet</p>
  97. */
  98. EVENT_AUTHENTICATION_FAILURE,
  99. /**
  100. * A received packet was not valid
  101. *
  102. * <p>Meta-data: {@link InetSocketAddress} containing origin address of packet</p>
  103. */
  104. EVENT_INVALID_PACKET,
  105. /**
  106. * Trace (debugging) message
  107. *
  108. * <p>These events are only generated if this is a TRACE-enabled build.</p>
  109. *
  110. * <p>Meta-data: {@link String}, TRACE message</p>
  111. */
  112. EVENT_TRACE
  113. }