PacketPriority.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (c) 2014, Oculus VR, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. *
  9. */
  10. /// \file
  11. /// \brief This file contains enumerations for packet priority and reliability enumerations.
  12. ///
  13. #ifndef __PACKET_PRIORITY_H
  14. #define __PACKET_PRIORITY_H
  15. /// These enumerations are used to describe when packets are delivered.
  16. enum PacketPriority
  17. {
  18. /// The highest possible priority. These message trigger sends immediately, and are generally not buffered or aggregated into a single datagram.
  19. IMMEDIATE_PRIORITY,
  20. /// For every 2 IMMEDIATE_PRIORITY messages, 1 HIGH_PRIORITY will be sent.
  21. /// Messages at this priority and lower are buffered to be sent in groups at 10 millisecond intervals to reduce UDP overhead and better measure congestion control.
  22. HIGH_PRIORITY,
  23. /// For every 2 HIGH_PRIORITY messages, 1 MEDIUM_PRIORITY will be sent.
  24. /// Messages at this priority and lower are buffered to be sent in groups at 10 millisecond intervals to reduce UDP overhead and better measure congestion control.
  25. MEDIUM_PRIORITY,
  26. /// For every 2 MEDIUM_PRIORITY messages, 1 LOW_PRIORITY will be sent.
  27. /// Messages at this priority and lower are buffered to be sent in groups at 10 millisecond intervals to reduce UDP overhead and better measure congestion control.
  28. LOW_PRIORITY,
  29. /// \internal
  30. NUMBER_OF_PRIORITIES
  31. };
  32. /// These enumerations are used to describe how packets are delivered.
  33. /// \note Note to self: I write this with 3 bits in the stream. If I add more remember to change that
  34. /// \note In ReliabilityLayer::WriteToBitStreamFromInternalPacket I assume there are 5 major types
  35. /// \note Do not reorder, I check on >= UNRELIABLE_WITH_ACK_RECEIPT
  36. enum PacketReliability
  37. {
  38. /// Same as regular UDP, except that it will also discard duplicate datagrams. RakNet adds (6 to 17) + 21 bits of overhead, 16 of which is used to detect duplicate packets and 6 to 17 of which is used for message length.
  39. UNRELIABLE,
  40. /// Regular UDP with a sequence counter. Out of order messages will be discarded.
  41. /// Sequenced and ordered messages sent on the same channel will arrive in the order sent.
  42. UNRELIABLE_SEQUENCED,
  43. /// The message is sent reliably, but not necessarily in any order. Same overhead as UNRELIABLE.
  44. RELIABLE,
  45. /// This message is reliable and will arrive in the order you sent it. Messages will be delayed while waiting for out of order messages. Same overhead as UNRELIABLE_SEQUENCED.
  46. /// Sequenced and ordered messages sent on the same channel will arrive in the order sent.
  47. RELIABLE_ORDERED,
  48. /// This message is reliable and will arrive in the sequence you sent it. Out or order messages will be dropped. Same overhead as UNRELIABLE_SEQUENCED.
  49. /// Sequenced and ordered messages sent on the same channel will arrive in the order sent.
  50. RELIABLE_SEQUENCED,
  51. /// Same as UNRELIABLE, however the user will get either ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS based on the result of sending this message when calling RakPeerInterface::Receive(). Bytes 1-4 will contain the number returned from the Send() function. On disconnect or shutdown, all messages not previously acked should be considered lost.
  52. UNRELIABLE_WITH_ACK_RECEIPT,
  53. /// Same as UNRELIABLE_SEQUENCED, however the user will get either ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS based on the result of sending this message when calling RakPeerInterface::Receive(). Bytes 1-4 will contain the number returned from the Send() function. On disconnect or shutdown, all messages not previously acked should be considered lost.
  54. /// 05/04/10 You can't have sequenced and ack receipts, because you don't know if the other system discarded the message, meaning you don't know if the message was processed
  55. // UNRELIABLE_SEQUENCED_WITH_ACK_RECEIPT,
  56. /// Same as RELIABLE. The user will also get ID_SND_RECEIPT_ACKED after the message is delivered when calling RakPeerInterface::Receive(). ID_SND_RECEIPT_ACKED is returned when the message arrives, not necessarily the order when it was sent. Bytes 1-4 will contain the number returned from the Send() function. On disconnect or shutdown, all messages not previously acked should be considered lost. This does not return ID_SND_RECEIPT_LOSS.
  57. RELIABLE_WITH_ACK_RECEIPT,
  58. /// Same as RELIABLE_ORDERED_ACK_RECEIPT. The user will also get ID_SND_RECEIPT_ACKED after the message is delivered when calling RakPeerInterface::Receive(). ID_SND_RECEIPT_ACKED is returned when the message arrives, not necessarily the order when it was sent. Bytes 1-4 will contain the number returned from the Send() function. On disconnect or shutdown, all messages not previously acked should be considered lost. This does not return ID_SND_RECEIPT_LOSS.
  59. RELIABLE_ORDERED_WITH_ACK_RECEIPT,
  60. /// Same as RELIABLE_SEQUENCED. The user will also get ID_SND_RECEIPT_ACKED after the message is delivered when calling RakPeerInterface::Receive(). Bytes 1-4 will contain the number returned from the Send() function. On disconnect or shutdown, all messages not previously acked should be considered lost.
  61. /// 05/04/10 You can't have sequenced and ack receipts, because you don't know if the other system discarded the message, meaning you don't know if the message was processed
  62. // RELIABLE_SEQUENCED_WITH_ACK_RECEIPT,
  63. /// \internal
  64. NUMBER_OF_RELIABILITIES
  65. };
  66. #endif
粤ICP备19079148号