Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is the DTLS 20-64 when parsing the received packet #1672

Open
a839419160 opened this issue Jan 11, 2021 · 0 comments
Open

Why is the DTLS 20-64 when parsing the received packet #1672

a839419160 opened this issue Jan 11, 2021 · 0 comments

Comments

@a839419160
Copy link

See the description in RFC5764:The process for demultiplexing a packet is as follows. The receiver looks at the first byte of the packet. If the value of this byte is 0 or 1, then the packet is STUN. If the value is in between 128 and 191 (inclusive), then the packet is RTP (or RTCP, if both RTCP and RTP are being multiplexed over the same destination port). If the value is between 20 and 63 (inclusive), the packet is DTLS.

DtlsSocketContext::PacketType DtlsSocketContext::demuxPacket(const unsigned char *data, unsigned int len) {
  assert(len >= 1);
  if ((data[0] == 0)   || (data[0] == 1))
  return stun;
  if ((data[0] >= 128) && (data[0] <= 191))
  return rtp;
  if ((data[0] >= 20)  && (data[0] <= 64))
  return dtls;

  return unknown;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant