turn_types/message.rs
1// Copyright (C) 2025 Matthew Waters <matthew@centricular.com>
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6// option. This file may not be copied, modified, or distributed
7// except according to those terms.
8
9//! Module for TURN message types in addition to those specified by STUN.
10
11use stun_types::message::Method;
12
13/// The value of the Allocate message type. Can only be used in a request message.
14pub const ALLOCATE: Method = Method::new(0x0003);
15
16/// The value of the Refresh message type. Can only be used in a request message.
17pub const REFRESH: Method = Method::new(0x0004);
18
19/// The value of the Send message type. Can only be used in an indication message.
20pub const SEND: Method = Method::new(0x0006);
21
22/// The value of the Data message type. Can only be used in an indication message.
23pub const DATA: Method = Method::new(0x0007);
24
25/// The value of the CreatePermission message type. Can only be used in request message.
26pub const CREATE_PERMISSION: Method = Method::new(0x0008);
27
28/// The value of the ChannelBind message type. Can only be used in a request message.
29pub const CHANNEL_BIND: Method = Method::new(0x0009);
30
31/// The value of the Connect message type. Can only be used in a request message.
32pub const CONNECT: Method = Method::new(0x000a);
33
34/// The value of the ConnectionBind message type. Can only be used in a request message.
35pub const CONNECTION_BIND: Method = Method::new(0x000b);
36
37/// The value of the ConnectionAttempt message type. Can only be used in a request message.
38pub const CONNECTION_ATTEMPT: Method = Method::new(0x000c);
39
40pub(crate) fn debug_init() {
41 #[cfg(feature = "std")]
42 {
43 ALLOCATE.add_name("ALLOCATE");
44 REFRESH.add_name("REFRESH");
45 SEND.add_name("SEND");
46 DATA.add_name("DATA");
47 CREATE_PERMISSION.add_name("CREATE_PERMISSION");
48 CHANNEL_BIND.add_name("CHANNEL_BIND");
49 CONNECT.add_name("CONNECT");
50 CONNECTION_BIND.add_name("CONNECTION_BIND");
51 CONNECTION_ATTEMPT.add_name("CONNECTION_ATTEMPT");
52 }
53}