netwerk/sctp/datachannel/DataChannelProtocol.h

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set ts=2 et sw=2 tw=80: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef NETWERK_SCTP_DATACHANNEL_DATACHANNELPROTOCOL_H_
michael@0 8 #define NETWERK_SCTP_DATACHANNEL_DATACHANNELPROTOCOL_H_
michael@0 9
michael@0 10 #if defined(__GNUC__)
michael@0 11 #define SCTP_PACKED __attribute__((packed))
michael@0 12 #elif defined(_MSC_VER)
michael@0 13 #pragma pack (push, 1)
michael@0 14 #define SCTP_PACKED
michael@0 15 #else
michael@0 16 #error "Unsupported compiler"
michael@0 17 #endif
michael@0 18
michael@0 19 // Duplicated in fsm.def
michael@0 20 #define WEBRTC_DATACHANNEL_STREAMS_DEFAULT 256
michael@0 21
michael@0 22 #define DATA_CHANNEL_PPID_CONTROL 50
michael@0 23 #define DATA_CHANNEL_PPID_BINARY 52
michael@0 24 #define DATA_CHANNEL_PPID_BINARY_LAST 53
michael@0 25 #define DATA_CHANNEL_PPID_DOMSTRING 54
michael@0 26 #define DATA_CHANNEL_PPID_DOMSTRING_LAST 51
michael@0 27
michael@0 28 #define DATA_CHANNEL_MAX_BINARY_FRAGMENT 0x4000
michael@0 29
michael@0 30 #define DATA_CHANNEL_FLAGS_SEND_REQ 0x00000001
michael@0 31 #define DATA_CHANNEL_FLAGS_SEND_RSP 0x00000002
michael@0 32 #define DATA_CHANNEL_FLAGS_SEND_ACK 0x00000004
michael@0 33 #define DATA_CHANNEL_FLAGS_OUT_OF_ORDER_ALLOWED 0x00000008
michael@0 34 #define DATA_CHANNEL_FLAGS_SEND_DATA 0x00000010
michael@0 35 #define DATA_CHANNEL_FLAGS_FINISH_OPEN 0x00000020
michael@0 36 #define DATA_CHANNEL_FLAGS_FINISH_RSP 0x00000040
michael@0 37 #define DATA_CHANNEL_FLAGS_EXTERNAL_NEGOTIATED 0x00000080
michael@0 38 #define DATA_CHANNEL_FLAGS_WAITING_ACK 0x00000100
michael@0 39
michael@0 40 #define INVALID_STREAM (0xFFFF)
michael@0 41 // max is 0xFFFF: Streams 0 to 0xFFFE = 0xFFFF streams
michael@0 42 #define MAX_NUM_STREAMS (2048)
michael@0 43
michael@0 44 struct rtcweb_datachannel_open_request {
michael@0 45 uint8_t msg_type; // DATA_CHANNEL_OPEN
michael@0 46 uint8_t channel_type;
michael@0 47 int16_t priority;
michael@0 48 uint32_t reliability_param;
michael@0 49 uint16_t label_length;
michael@0 50 uint16_t protocol_length;
michael@0 51 char label[1]; // (and protocol) keep VC++ happy...
michael@0 52 } SCTP_PACKED;
michael@0 53
michael@0 54 struct rtcweb_datachannel_ack {
michael@0 55 uint8_t msg_type; // DATA_CHANNEL_ACK
michael@0 56 } SCTP_PACKED;
michael@0 57
michael@0 58 /* msg_type values: */
michael@0 59 /* 0-1 were used in an early version of the protocol with 3-way handshakes */
michael@0 60 #define DATA_CHANNEL_ACK 2
michael@0 61 #define DATA_CHANNEL_OPEN_REQUEST 3
michael@0 62
michael@0 63 /* channel_type values: */
michael@0 64 #define DATA_CHANNEL_RELIABLE 0x00
michael@0 65 #define DATA_CHANNEL_PARTIAL_RELIABLE_REXMIT 0x01
michael@0 66 #define DATA_CHANNEL_PARTIAL_RELIABLE_TIMED 0x02
michael@0 67
michael@0 68 #define DATA_CHANNEL_RELIABLE_UNORDERED 0x80
michael@0 69 #define DATA_CHANNEL_PARTIAL_RELIABLE_REXMIT_UNORDERED 0x81
michael@0 70 #define DATA_CHANNEL_PARTIAL_RELIABLE_TIMED_UNORDERED 0x82
michael@0 71
michael@0 72 #define ERR_DATA_CHANNEL_ALREADY_OPEN 1
michael@0 73 #define ERR_DATA_CHANNEL_NONE_AVAILABLE 2
michael@0 74
michael@0 75 #if defined(_MSC_VER)
michael@0 76 #pragma pack (pop)
michael@0 77 #undef SCTP_PACKED
michael@0 78 #endif
michael@0 79
michael@0 80 #endif

mercurial