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

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

mercurial