blob: 68251cd1058c8ca055f01e3a20bd35146af34357
1 | /* ***** BEGIN LICENSE BLOCK ***** |
2 | * Source last modified: $Id: rdtpck.h,v 1.1.1.1.2.1 2005/05/04 18:20:57 hubbe Exp $ |
3 | * |
4 | * REALNETWORKS CONFIDENTIAL--NOT FOR DISTRIBUTION IN SOURCE CODE FORM |
5 | * Portions Copyright (c) 1995-2005 RealNetworks, Inc. |
6 | * All Rights Reserved. |
7 | * |
8 | * The contents of this file, and the files included with this file, |
9 | * are subject to the current version of the Real Format Source Code |
10 | * Porting and Optimization License, available at |
11 | * https://helixcommunity.org/2005/license/realformatsource (unless |
12 | * RealNetworks otherwise expressly agrees in writing that you are |
13 | * subject to a different license). You may also obtain the license |
14 | * terms directly from RealNetworks. You may not use this file except |
15 | * in compliance with the Real Format Source Code Porting and |
16 | * Optimization License. There are no redistribution rights for the |
17 | * source code of this file. Please see the Real Format Source Code |
18 | * Porting and Optimization License for the rights, obligations and |
19 | * limitations governing use of the contents of the file. |
20 | * |
21 | * RealNetworks is the developer of the Original Code and owns the |
22 | * copyrights in the portions it created. |
23 | * |
24 | * This file, and the files included with this file, is distributed and |
25 | * made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, |
26 | * EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL |
27 | * SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF |
28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT |
29 | * OR NON-INFRINGEMENT. |
30 | * |
31 | * Technology Compatibility Kit Test Suite(s) Location: |
32 | * https://rarvcode-tck.helixcommunity.org |
33 | * |
34 | * Contributor(s): |
35 | * |
36 | * ***** END LICENSE BLOCK ***** */ |
37 | |
38 | #ifndef RDTPACKET_H |
39 | #define RDTPACKET_H |
40 | |
41 | #include <string.h> |
42 | #include "helix_types.h" |
43 | #include "helix_result.h" |
44 | #include "rm_memory.h" |
45 | |
46 | #ifdef __cplusplus |
47 | extern "C" { |
48 | #endif |
49 | |
50 | |
51 | /* |
52 | * |
53 | * Packet util functions and types |
54 | * |
55 | */ |
56 | |
57 | #define RDT_ASM_ACTION_PKT 0xFF00 |
58 | #define RDT_BW_REPORT_PKT 0xFF01 |
59 | #define RDT_ACK_PKT 0xFF02 |
60 | #define RDT_RTT_REQUEST_PKT 0xFF03 |
61 | #define RDT_RTT_RESPONSE_PKT 0xFF04 |
62 | #define RDT_CONGESTION_PKT 0xFF05 |
63 | #define RDT_STREAM_END_PKT 0xFF06 |
64 | #define RDT_REPORT_PKT 0xFF07 |
65 | #define RDT_LATENCY_REPORT_PKT 0xFF08 |
66 | #define RDT_TRANS_INFO_RQST_PKT 0xFF09 |
67 | #define RDT_TRANS_INFO_RESP_PKT 0xFF0A |
68 | #define RDT_BANDWIDTH_PROBE_PKT 0xFF0B |
69 | |
70 | #define RDT_DATA_PACKET 0xFFFE |
71 | #define RDT_UNKNOWN_TYPE 0xFFFF |
72 | |
73 | |
74 | |
75 | /* |
76 | * |
77 | * The tngpkt.h file included below is auto-generated from the master |
78 | * header file which contains the bit by bit definitions of the packet |
79 | * structures(tngpkt.pm). The structures defined in tngpkt.h are |
80 | * easier to use compared to the actual packet definitions in |
81 | * tngpkt.pm. tngpkt.h also includes pack and unpack functions that |
82 | * can convert these structures to and from the binary wire format of |
83 | * the different packet types. |
84 | * |
85 | */ |
86 | #include "tngpkt.h" |
87 | |
88 | |
89 | /* All seq numbers will be marked as lost [beg, end]. */ |
90 | /* Caller is responsible for free'ing the bit-field that is allocated |
91 | * ( "pkt->data.data"). |
92 | */ |
93 | void createNAKPacket(struct TNGACKPacket* pkt, |
94 | UINT16 unStreamNum, |
95 | UINT16 unBegSeqNum, |
96 | UINT16 unEndSeqNum |
97 | ); |
98 | |
99 | void createNAKPacketFromPool(struct TNGACKPacket* pkt, |
100 | UINT16 unStreamNum, |
101 | UINT16 unBegSeqNum, |
102 | UINT16 unEndSeqNum, |
103 | rm_malloc_func_ptr fpMalloc, |
104 | void* pMemoryPool |
105 | ); |
106 | |
107 | |
108 | |
109 | /* All seq numbers will be marked as received [beg, end]. The caller |
110 | * must free the 'pkt->data.data' malloc'ed memory. |
111 | */ |
112 | void createACKPacket(struct TNGACKPacket* pkt, |
113 | UINT16 unStreamNum, |
114 | UINT16 unBegSeqNum, |
115 | UINT16 unEndSeqNum |
116 | ); |
117 | |
118 | void createACKPacketFromPool(struct TNGACKPacket* pkt, |
119 | UINT16 unStreamNum, |
120 | UINT16 unBegSeqNum, |
121 | UINT16 unEndSeqNum, |
122 | rm_malloc_func_ptr fpMalloc, |
123 | void* pMemoryPool |
124 | ); |
125 | |
126 | /* |
127 | * Returns the packet type of the packet in the buffer that was just |
128 | * read off of the wire |
129 | */ |
130 | UINT16 GetRDTPacketType(UINT8* pBuf, UINT32 nLen); |
131 | |
132 | |
133 | |
134 | /* |
135 | * Marshalling inline funcs. |
136 | */ |
137 | |
138 | UINT8 getbyte(UINT8* data); |
139 | UINT16 getshort(UINT8* data); |
140 | INT32 getlong(UINT8* data); |
141 | void putbyte(UINT8* data, INT8 v); |
142 | void putshort(UINT8* data, UINT16 v); |
143 | void putlong(UINT8* data, UINT32 v); |
144 | UINT8* addbyte(UINT8* cp, UINT8 data); |
145 | UINT8* addshort(UINT8* cp, UINT16 data); |
146 | UINT8* addlong(UINT8* cp, UINT32 data); |
147 | UINT8* addstring(UINT8* cp, const UINT8* string, int len); |
148 | |
149 | #ifdef __cplusplus |
150 | } |
151 | #endif |
152 | |
153 | #endif /* RDTPACKET_H */ |
154 |