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 be used in either a request or an indication
14/// message.
15pub const ALLOCATE: Method = Method::new(0x0003);
16
17/// The value of the Refresh message type.  Can be used in either a request or an indication
18/// message.
19pub const REFRESH: Method = Method::new(0x0004);
20
21/// The value of the Send message type.  Can only be used in an indication message.
22pub const SEND: Method = Method::new(0x0006);
23
24/// The value of the Data message type.  Can only be used in an indication message.
25pub const DATA: Method = Method::new(0x0007);
26
27/// The value of the CreatePermission message type.  Can be used in either a request or an indication
28/// message.
29pub const CREATE_PERMISSION: Method = Method::new(0x0008);
30
31/// The value of the ChannelBind message type.  Can be used in either a request or an indication
32/// message.
33pub const CHANNEL_BIND: Method = Method::new(0x0009);
34
35pub(crate) fn debug_init() {
36    ALLOCATE.add_name("ALLOCATE");
37    REFRESH.add_name("REFRESH");
38    SEND.add_name("SEND");
39    DATA.add_name("DATA");
40    CREATE_PERMISSION.add_name("CREATE_PERMISSION");
41    CHANNEL_BIND.add_name("CHANNEL_BIND");
42}