1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** NetX Component                                                        */
16 /**                                                                       */
17 /**   Real Time Transport Protocol (RTP)                                  */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 
23 /**************************************************************************/
24 /*                                                                        */
25 /*  APPLICATION INTERFACE DEFINITION                       RELEASE        */
26 /*                                                                        */
27 /*    nx_rtp_sender.h                                     PORTABLE C      */
28 /*                                                           6.4.0        */
29 /*  AUTHOR                                                                */
30 /*                                                                        */
31 /*    Haiqing Zhao, Microsoft Corporation                                 */
32 /*                                                                        */
33 /*  DESCRIPTION                                                           */
34 /*                                                                        */
35 /*    This file defines the NetX RTP Sender component, including all      */
36 /*    data types and external references.                                 */
37 /*                                                                        */
38 /*  RELEASE HISTORY                                                       */
39 /*                                                                        */
40 /*    DATE              NAME                      DESCRIPTION             */
41 /*                                                                        */
42 /*  10-31-2023     Haiqing Zhao             Initial Version 6.3.0         */
43 /*  12-31-2023     Haiqing Zhao             Modified comments(s),         */
44 /*                                            supported VLAN,             */
45 /*                                            resulting in version 6.4.0  */
46 /*                                                                        */
47 /**************************************************************************/
48 
49 #ifndef _NX_RTP_SENDER_H_
50 #define _NX_RTP_SENDER_H_
51 
52 #include "tx_api.h"
53 #include "nx_api.h"
54 
55 /* Determine if a C++ compiler is being used.  If so, ensure that standard
56    C is used to process the API information.  */
57 
58 #ifdef __cplusplus
59 /* Yes, C++ compiler is present.  Use standard C.  */
60 extern   "C" {
61 
62 #endif
63 
64 #ifdef NX_DISABLE_PACKET_CHAIN
65 #error "NX_DISABLE_PACKET_CHAIN must not be defined"
66 #endif /* NX_DISABLE_PACKET_CHAIN */
67 
68 /* Define UDP socket create options.  */
69 #ifndef NX_RTP_SENDER_TYPE_OF_SERVICE
70 #define NX_RTP_SENDER_TYPE_OF_SERVICE                   NX_IP_NORMAL
71 #endif /* NX_RTP_SENDER_TYPE_OF_SERVICE */
72 
73 #ifndef NX_RTP_SENDER_FRAGMENT_OPTION
74 #define NX_RTP_SENDER_FRAGMENT_OPTION                   NX_FRAGMENT_OKAY
75 #endif /* NX_RTP_SENDER_FRAGMENT_OPTION */
76 
77 #ifndef NX_RTP_SENDER_TIME_TO_LIVE
78 #define NX_RTP_SENDER_TIME_TO_LIVE                      0x80
79 #endif /* NX_RTP_SENDER_TIME_TO_LIVE */
80 
81 #ifndef NX_RTP_SENDER_QUEUE_DEPTH
82 #define NX_RTP_SENDER_QUEUE_DEPTH                       5
83 #endif /* NX_RTP_SENDER_QUEUE_DEPTH */
84 
85 #ifndef NX_RTP_SENDER_PACKET_TIMEOUT
86 #define NX_RTP_SENDER_PACKET_TIMEOUT                    (1 * NX_IP_PERIODIC_RATE)
87 #endif /* NX_RTP_SENDER_PACKET_TIMEOUT */
88 
89 /* 5 seconds is the recommended minimum interval by RFC 3550, Chapter 6.2. */
90 #ifndef NX_RTCP_INTERVAL
91 #define NX_RTCP_INTERVAL                                5
92 #endif /* NX_RTCP_INTERVAL */
93 
94 /* RTP Payload Type Table - Reference RFC 3551, Page33-34, Table 4-5 */
95 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_PCMU           0       /* G.711 */
96 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_GSM            3
97 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_G723           4
98 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_DVI4_8000HZ    5
99 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_DVI4_16000HZ   6
100 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_LPC            7
101 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_PCMA           8       /* G.711 */
102 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_G722           9
103 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_L16_2_CHANNELS 10
104 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_L16_1_CHANNEL  11
105 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_QCELP          12
106 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_CN             13
107 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_MPA            14      /* RFC 2250 */
108 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_G728           15
109 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_DVI4_11025HZ   16
110 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_DVI4_22050HZ   17
111 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_G729           18
112 #define NX_RTP_SENDER_PAYLOAD_TYPE_VIDEO_CELB           25      /* RFC 2029 */
113 #define NX_RTP_SENDER_PAYLOAD_TYPE_VIDEO_JPEG           26      /* RFC 2435 */
114 #define NX_RTP_SENDER_PAYLOAD_TYPE_VIDEO_NV             28
115 #define NX_RTP_SENDER_PAYLOAD_TYPE_VIDEO_H261           31      /* RFC 2032 */
116 #define NX_RTP_SENDER_PAYLOAD_TYPE_VIDEO_MPV            32      /* RFC 2250 */
117 #define NX_RTP_SENDER_PAYLOAD_TYPE_AUDIO_VIDEO_MP2T     33      /* RFC 2250 */
118 #define NX_RTP_SENDER_PAYLOAD_TYPE_VIDEO_H263           34      /* RFC 2190 */
119 #define NX_RTP_SENDER_PAYLOAD_TYPE_DYNAMIC_MIN          96
120 #define NX_RTP_SENDER_PAYLOAD_TYPE_DYNAMIC_MAX          127
121 
122 /* Use the string "RTPS" as a magic number for RTP sender */
123 #define NX_RTP_SENDER_ID                                0x52545053
124 #define NX_RTP_SESSION_ID                               0x52545054
125 
126 /* The initial target rtp port to use - Reference RFC3551, section 8, p35 */
127 #define NX_RTP_SENDER_INITIAL_RTP_PORT                  5004
128 
129 /* The rtp header length and corresponding rtp packet header size */
130 #define NX_RTP_HEADER_LENGTH                            12
131 #define NX_RTP_PACKET                                   (NX_UDP_PACKET + NX_RTP_HEADER_LENGTH)
132 
133 /* Define RTP protocol version.  */
134 #define NX_RTP_VERSION                                  2
135 
136 /* Define RTP header field(s) */
137 #define NX_RTP_HEADER_MARKER_BIT                        0x80
138 
139 /* Define RTCP packet types.  */
140 #define NX_RTCP_TYPE_SR                                 200
141 #define NX_RTCP_TYPE_RR                                 201
142 #define NX_RTCP_TYPE_SDES                               202
143 
144 /* Define SDES types.  */
145 #define NX_RTCP_SDES_TYPE_CNAME                         1
146 
147 /* Define mask for version and padding bit pair. */
148 #define NX_RTCP_COUNT_MASK                              0x1F
149 #define NX_RTCP_VERSION_MASK                            0xC0
150 #define NX_RTCP_PAD_MASK                                0x20
151 #define NX_RTCP_TYPE_MASK                               0xFE
152 #define NX_RTCP_VERSION_VALUE                           (NX_RTP_VERSION << 6)
153 #define NX_RTCP_PAD_VALUE                               0
154 
155 /* Define receiver report structure for user callback. */
156 typedef struct NX_RTCP_RECEIVER_REPORT_STRUCT
157 {
158     UINT receiver_ssrc;
159     UINT fraction_loss;
160     INT  packet_loss;
161     UINT extended_max;
162     UINT jitter;
163     UINT last_sr;
164     UINT delay;
165 } NX_RTCP_RECEIVER_REPORT;
166 
167 /* Define SDES information structure for user callback. */
168 typedef struct NX_RTCP_SDES_INFO_STRUCT
169 {
170     UINT   ssrc;
171     UCHAR *cname;
172     ULONG  cname_length;
173 } NX_RTCP_SDES_INFO;
174 
175 /* Define RTCP packet header structure for internal packet processing.  */
176 typedef struct NX_RTCP_HEADER_STRUCT
177 {
178     /* V(2), P(1), RC(5). */
179     UCHAR nx_rtcp_byte0;
180 
181     /* RTCP packet type. */
182     UCHAR nx_rtcp_packet_type;
183 
184     /* Packet length in words. */
185     USHORT nx_rtcp_length;
186 } NX_RTCP_HEADER;
187 
188 /* Define RTCP report block structure for internal packet processing. */
189 typedef struct NX_RTCP_REPORT_STRUCT
190 {
191 
192     /* Data source being reported. */
193     ULONG nx_rtcp_report_ssrc;
194 
195     /* Fraction loss + cumulative number of packets lost. */
196     ULONG nx_rtcp_report_loss;
197 
198     /* Extended hightest sequence number received. */
199     ULONG nx_rtcp_report_extended_max;
200 
201     /* Data packet inter-arrival time. */
202     ULONG nx_rtcp_report_jitter;
203 
204     /* The middle 32 bits out of 64 in the NTP timestamp. */
205     ULONG nx_rtcp_report_last_sr;
206 
207     /* Delay since last SR timestamp. */
208     ULONG nx_rtcp_report_delay;
209 } NX_RTCP_REPORT;
210 
211 /* Define RTCP RR block for internal packet processing. */
212 typedef struct NX_RTCP_RR_STRUCT
213 {
214     /* Packet header. */
215     NX_RTCP_HEADER nx_rtcp_rr_header;
216 
217     /* RTCP packet type. */
218     ULONG nx_rtcp_rr_ssrc;
219 
220     /* Reception report block. */
221     NX_RTCP_REPORT nx_rtcp_rr_report;
222 } NX_RTCP_RR;
223 
224 /* Define RTCP SR structure for internal packet processing. */
225 typedef struct NX_RTCP_SR_STRUCT
226 {
227     NX_RTCP_HEADER nx_rtcp_sr_header;
228     ULONG          nx_rtcp_sr_ssrc;
229     ULONG          nx_rtcp_sr_ntp_timestamp_msw;
230     ULONG          nx_rtcp_sr_ntp_timestamp_lsw;
231     ULONG          nx_rtcp_sr_rtp_timestamp;
232     ULONG          nx_rtcp_sr_rtp_packet_count;
233     ULONG          nx_rtcp_sr_rtp_octet_count;
234 } NX_RTCP_SR;
235 
236 /* Define RTCP SDES item structure for internal packet processing. */
237 typedef struct NX_RTCP_SDES_ITEM_STRUCT
238 {
239     UCHAR nx_rtcp_sdes_type; /* Chunk type. */
240     UCHAR nx_rtcp_sdes_length;
241     UCHAR nx_rtcp_sdes_data[1];
242 } NX_RTCP_SDES_ITEM;
243 
244 /* Define RTCP SDES chunk structure for internal packet processing. */
245 typedef struct NX_RTCP_SDES_CHUNK_STRUCT
246 {
247     ULONG             nx_rtcp_sdes_ssrc;
248     NX_RTCP_SDES_ITEM nx_rtcp_sdes_item[1];
249 } NX_RTCP_SDES_CHUNK;
250 
251 typedef struct NX_RTP_SESSION_STRUCT NX_RTP_SESSION;
252 
253 typedef struct NX_RTP_SENDER_STRUCT
254 {
255 
256     /* Store the magic number for RTP sender service */
257     ULONG           nx_rtp_sender_id;
258 
259     /* Pointer to IP structure of the corresponding IP instance. */
260     NX_IP          *nx_rtp_sender_ip_ptr;
261 
262     /* Pointer to RTP sender packet pool   */
263     NX_PACKET_POOL *nx_rtp_sender_packet_pool_ptr;
264 
265     /* Mutex to protect critical section such as sequence number and so on */
266     TX_MUTEX        nx_rtp_sender_protection;
267 
268     /* Local RTP/RTCP port & socket */
269     USHORT          nx_rtp_sender_rtp_port;
270     USHORT          nx_rtp_sender_rtcp_port;
271     NX_UDP_SOCKET   nx_rtp_sender_rtp_socket;
272     NX_UDP_SOCKET   nx_rtp_sender_rtcp_socket;
273 
274     /* Callback function to process rtcp messages. */
275     UINT          (*nx_rtp_sender_rtcp_receiver_report_cb)(NX_RTP_SESSION *rtp_session, NX_RTCP_RECEIVER_REPORT *rtcp_receiver_report);
276     UINT          (*nx_rtp_sender_rtcp_sdes_cb)(NX_RTCP_SDES_INFO *sdes_info);
277 
278     /* RTP sender name */
279     CHAR           *nx_rtp_sender_cname;
280     UCHAR           nx_rtp_sender_cname_length;
281 
282     NX_RTP_SESSION *nx_rtp_sender_session_created_ptr;
283 } NX_RTP_SENDER;
284 
285 struct NX_RTP_SESSION_STRUCT
286 {
287 
288     /* Store the pointer for the corresponding rtp sender */
289     NX_RTP_SENDER                *nx_rtp_sender;
290 
291     /* Store the magic number for the specific RTP session */
292     ULONG                         nx_rtp_session_id;
293 
294     /* Store the ip interface index when session created. */
295     UINT                          nx_rtp_session_interface_index;
296 
297 
298     /* Store the vlan priority for the rtp packets transferred in the session */
299     UINT                          nx_rtp_session_vlan_priority;
300 
301     /* Receiver's IP address and port number */
302     NXD_ADDRESS                   nx_rtp_session_peer_ip_address;
303     USHORT                        nx_rtp_session_peer_rtp_port;
304     USHORT                        nx_rtp_session_peer_rtcp_port;
305 
306     /* RTP header */
307     UCHAR                         nx_rtp_session_reserved;         /* Alignment */
308     UCHAR                         nx_rtp_session_payload_type;     /* Type, to be programmed into payload type field in RTP header */
309     USHORT                        nx_rtp_session_sequence_number;  /* Session sequence number */
310     ULONG                         nx_rtp_session_ssrc;
311 
312     /* The maximum frame packet size computed corresponding to mtu. */
313     ULONG                         nx_rtp_session_max_packet_size;
314 
315     /* None zero value: sample-based encoding
316        Default zero value: frame-based encoding */
317     ULONG                         nx_rtp_session_sample_factor;
318 
319     /* RTCP statistics */
320 
321     /* The total number of RTP data packets transmitted by the sender. */
322     ULONG                         nx_rtp_session_packet_count;
323 
324     /* The total number of payload octets transmitted by the sender. */
325     ULONG                         nx_rtp_session_octet_count;
326 
327     /* The timestamp of last sent RTP packet. */
328     ULONG                         nx_rtp_session_rtp_timestamp;
329 
330     /* The most significant word of the NTP timestamp corresponds to the same time as the RTP timestamp. */
331     ULONG                         nx_rtp_session_ntp_timestamp_msw;
332 
333     /* The least significant word of the NTP timestamp corresponds to the same time as the RTP timestamp. */
334     ULONG                         nx_rtp_session_ntp_timestamp_lsw;
335 
336     /* The last time an RTCP packet was transmitted. */
337     ULONG                         nx_rtp_session_rtcp_time;
338 
339     struct NX_RTP_SESSION_STRUCT *nx_rtp_session_next;
340 };
341 
342 typedef struct NX_RTP_HEADER_STRUCT
343 {
344     UCHAR  nx_rtp_header_field0;
345     UCHAR  nx_rtp_header_field1;
346     USHORT nx_rtp_header_sequence_number;
347     ULONG  nx_rtp_header_timestamp;
348     ULONG  nx_rtp_header_ssrc;
349 } NX_RTP_HEADER;
350 
351 
352 #ifndef NX_RTP_SENDER_SOURCE_CODE
353 
354 /* Application caller is present, perform API mapping.  */
355 
356 /* Determine if error checking is desired.  If so, map API functions
357    to the appropriate error checking front-ends.  Otherwise, map API
358    functions to the core functions that actually perform the work.
359    Note: error checking is enabled by default.  */
360 #ifdef NX_DISABLE_ERROR_CHECKING
361 
362 /* Services without error checking.  */
363 #define nx_rtp_sender_create                            _nx_rtp_sender_create
364 #define nx_rtp_sender_delete                            _nx_rtp_sender_delete
365 #define nx_rtp_sender_port_get                          _nx_rtp_sender_port_get
366 #define nx_rtp_sender_session_create                    _nx_rtp_sender_session_create
367 #define nx_rtp_sender_session_delete                    _nx_rtp_sender_session_delete
368 #define nx_rtp_sender_session_sample_factor_set         _nx_rtp_sender_session_sample_factor_set
369 #define nx_rtp_sender_session_packet_allocate           _nx_rtp_sender_session_packet_allocate
370 #define nx_rtp_sender_session_packet_send               _nx_rtp_sender_session_packet_send
371 #define nx_rtp_sender_session_jpeg_send                 _nx_rtp_sender_session_jpeg_send
372 #define nx_rtp_sender_session_h264_send                 _nx_rtp_sender_session_h264_send
373 #define nx_rtp_sender_session_aac_send                  _nx_rtp_sender_session_aac_send
374 #define nx_rtp_sender_session_sequence_number_get       _nx_rtp_sender_session_sequence_number_get
375 #define nx_rtp_sender_session_ssrc_get                  _nx_rtp_sender_session_ssrc_get
376 #define nx_rtp_sender_session_vlan_priority_set         _nx_rtp_sender_session_vlan_priority_set
377 
378 #define nx_rtp_sender_rtcp_receiver_report_callback_set _nx_rtp_sender_rtcp_receiver_report_callback_set
379 #define nx_rtp_sender_rtcp_sdes_callback_set            _nx_rtp_sender_rtcp_sdes_callback_set
380 
381 #else
382 
383 /* Services with error checking.  */
384 #define nx_rtp_sender_create                            _nxe_rtp_sender_create
385 #define nx_rtp_sender_delete                            _nxe_rtp_sender_delete
386 #define nx_rtp_sender_port_get                          _nxe_rtp_sender_port_get
387 #define nx_rtp_sender_session_create                    _nxe_rtp_sender_session_create
388 #define nx_rtp_sender_session_delete                    _nxe_rtp_sender_session_delete
389 #define nx_rtp_sender_session_sample_factor_set         _nxe_rtp_sender_session_sample_factor_set
390 #define nx_rtp_sender_session_packet_allocate           _nxe_rtp_sender_session_packet_allocate
391 #define nx_rtp_sender_session_packet_send               _nxe_rtp_sender_session_packet_send
392 #define nx_rtp_sender_session_jpeg_send                 _nxe_rtp_sender_session_jpeg_send
393 #define nx_rtp_sender_session_h264_send                 _nxe_rtp_sender_session_h264_send
394 #define nx_rtp_sender_session_aac_send                  _nxe_rtp_sender_session_aac_send
395 #define nx_rtp_sender_session_sequence_number_get       _nxe_rtp_sender_session_sequence_number_get
396 #define nx_rtp_sender_session_ssrc_get                  _nxe_rtp_sender_session_ssrc_get
397 #define nx_rtp_sender_session_vlan_priority_set         _nxe_rtp_sender_session_vlan_priority_set
398 
399 #define nx_rtp_sender_rtcp_receiver_report_callback_set _nxe_rtp_sender_rtcp_receiver_report_callback_set
400 #define nx_rtp_sender_rtcp_sdes_callback_set            _nxe_rtp_sender_rtcp_sdes_callback_set
401 
402 #endif /* NX_DISABLE_ERROR_CHECKING */
403 
404 /* Define the prototypes accessible to the application software.  */
405 
406 /* Initiate RTP sender service, create UDP sockets. */
407 UINT nx_rtp_sender_create(NX_RTP_SENDER *rtp_sender, NX_IP *ip_ptr, NX_PACKET_POOL *pool_ptr, CHAR *cname, UCHAR cname_length);
408 
409 /* Terminate the RTP service */
410 UINT nx_rtp_sender_delete(NX_RTP_SENDER *rtp_sender);
411 
412 /* Obtain RTP/RTCP port numbers.  The port numbers may be used by RTSP */
413 UINT nx_rtp_sender_port_get(NX_RTP_SENDER *rtp_sender, UINT *rtp_port, UINT *rtcp_port);
414 
415 /* Setup a session, find and bind to available ports. */
416 UINT nx_rtp_sender_session_create(NX_RTP_SENDER *rtp_sender, NX_RTP_SESSION *session, ULONG payload_type,
417                                   UINT interface_index, NXD_ADDRESS *receiver_ip_address,
418                                   UINT receiver_rtp_port_number, UINT receiver_rtcp_port_number);
419 
420 /* Delete a session, and then it is available to re-setup the session */
421 UINT nx_rtp_sender_session_delete(NX_RTP_SESSION *session);
422 
423 /* Set the sample factor for sample-based mode inside the specific session. */
424 UINT nx_rtp_sender_session_sample_factor_set(NX_RTP_SESSION *session, UINT factor);
425 
426 /* Allocate and obtain a rtp session packet. */
427 UINT nx_rtp_sender_session_packet_allocate(NX_RTP_SESSION *session, NX_PACKET **packet_ptr, ULONG wait_option);
428 
429 /* Send payload data through a specific session. */
430 UINT nx_rtp_sender_session_packet_send(NX_RTP_SESSION *session, NX_PACKET *packet_ptr, ULONG timestamp, ULONG ntp_msw, ULONG ntp_lsw, UINT marker);
431 
432 /* API functions for sending video payload over rtp. */
433 UINT nx_rtp_sender_session_jpeg_send(NX_RTP_SESSION *session, UCHAR *frame_data, ULONG frame_data_size,
434                                      ULONG timestamp, ULONG ntp_msw, ULONG ntp_lsw, UINT marker);
435 UINT nx_rtp_sender_session_h264_send(NX_RTP_SESSION *session, UCHAR *frame_data, ULONG frame_data_size,
436                                      ULONG timestamp, ULONG ntp_msw, ULONG ntp_lsw, UINT marker);
437 
438 /* API functions for sending audio payload over rtp. */
439 UINT nx_rtp_sender_session_aac_send(NX_RTP_SESSION *session, UCHAR *frame_data, ULONG frame_data_size, ULONG timestamp, ULONG ntp_msw, ULONG ntp_lsw, UINT marker);
440 
441 /* Obtain the current sequence number inside the specific session. */
442 UINT nx_rtp_sender_session_sequence_number_get(NX_RTP_SESSION *session, UINT *sequence_number);
443 
444 /* Obtain the current ssrc inside the specific session. */
445 UINT nx_rtp_sender_session_ssrc_get(NX_RTP_SESSION *session, ULONG *ssrc);
446 
447 /* Set the vlan priority inside the specific session. */
448 UINT nx_rtp_sender_session_vlan_priority_set(NX_RTP_SESSION *session, UINT vlan_priority);
449 
450 /* Set a callback function to handle incoming RTCP message. */
451 UINT nx_rtp_sender_rtcp_receiver_report_callback_set(NX_RTP_SENDER *rtp_sender, UINT (*rtcp_rr_cb)(NX_RTP_SESSION *, NX_RTCP_RECEIVER_REPORT *));
452 UINT nx_rtp_sender_rtcp_sdes_callback_set(NX_RTP_SENDER *rtp_sender, UINT (*rtcp_sdes_cb)(NX_RTCP_SDES_INFO *));
453 
454 /* Set VLAN priority of RTP session. */
455 UINT nx_rtp_sender_session_vlan_priority_set(NX_RTP_SESSION *session, UINT vlan_priority);
456 
457 #else
458 
459 /* Define the prototypes accessible to the application software.  */
460 
461 UINT _nxe_rtp_sender_create(NX_RTP_SENDER *rtp_sender, NX_IP *ip_ptr, NX_PACKET_POOL *pool_ptr, CHAR *cname, UCHAR cname_length);
462 UINT _nx_rtp_sender_create(NX_RTP_SENDER *rtp_sender, NX_IP *ip_ptr, NX_PACKET_POOL *pool_ptr, CHAR *cname, UCHAR cname_length);
463 UINT _nxe_rtp_sender_delete(NX_RTP_SENDER *rtp_sender);
464 UINT _nx_rtp_sender_delete(NX_RTP_SENDER *rtp_sender);
465 UINT _nxe_rtp_sender_port_get(NX_RTP_SENDER *rtp_sender, UINT *rtp_port, UINT *rtcp_port);
466 UINT _nx_rtp_sender_port_get(NX_RTP_SENDER *rtp_sender, UINT *rtp_port, UINT *rtcp_port);
467 UINT _nxe_rtp_sender_session_create(NX_RTP_SENDER *rtp_sender, NX_RTP_SESSION *session, ULONG payload_type,
468                                     UINT interface_index, NXD_ADDRESS *receiver_ip_address,
469                                     UINT receiver_rtp_port_number, UINT receiver_rtcp_port_number);
470 UINT _nx_rtp_sender_session_create(NX_RTP_SENDER *rtp_sender, NX_RTP_SESSION *session, ULONG payload_type,
471                                    UINT interface_index, NXD_ADDRESS *receiver_ip_address,
472                                    UINT receiver_rtp_port_number, UINT receiver_rtcp_port_number);
473 UINT _nxe_rtp_sender_session_delete(NX_RTP_SESSION *session);
474 UINT _nx_rtp_sender_session_delete(NX_RTP_SESSION *session);
475 UINT _nxe_rtp_sender_session_sample_factor_set(NX_RTP_SESSION *session, UINT factor);
476 UINT _nx_rtp_sender_session_sample_factor_set(NX_RTP_SESSION *session, UINT factor);
477 UINT _nxe_rtp_sender_session_packet_allocate(NX_RTP_SESSION *session, NX_PACKET **packet_ptr, ULONG wait_option);
478 UINT _nx_rtp_sender_session_packet_allocate(NX_RTP_SESSION *session, NX_PACKET **packet_ptr, ULONG wait_option);
479 UINT _nxe_rtp_sender_session_packet_send(NX_RTP_SESSION *session, NX_PACKET *packet_ptr, ULONG timestamp, ULONG ntp_msw, ULONG ntp_lsw, UINT marker);
480 UINT _nx_rtp_sender_session_packet_send(NX_RTP_SESSION *session, NX_PACKET *packet_ptr, ULONG timestamp, ULONG ntp_msw, ULONG ntp_lsw, UINT marker);
481 UINT _nxe_rtp_sender_session_sequence_number_get(NX_RTP_SESSION *session, UINT *sequence_number);
482 UINT _nx_rtp_sender_session_sequence_number_get(NX_RTP_SESSION *session, UINT *sequence_number);
483 UINT _nxe_rtp_sender_session_jpeg_send(NX_RTP_SESSION *session, UCHAR *frame_data, ULONG frame_data_size,
484                                        ULONG timestamp, ULONG ntp_msw, ULONG ntp_lsw, UINT marker);
485 UINT _nx_rtp_sender_session_jpeg_send(NX_RTP_SESSION *session, UCHAR *frame_data, ULONG frame_data_size,
486                                        ULONG timestamp, ULONG ntp_msw, ULONG ntp_lsw, UINT marker);
487 UINT _nxe_rtp_sender_session_h264_send(NX_RTP_SESSION *session, UCHAR *frame_data, ULONG frame_data_size,
488                                        ULONG timestamp, ULONG ntp_msw, ULONG ntp_lsw, UINT marker);
489 UINT _nx_rtp_sender_session_h264_send(NX_RTP_SESSION *session, UCHAR *frame_data, ULONG frame_data_size,
490                                       ULONG timestamp, ULONG ntp_msw, ULONG ntp_lsw, UINT marker);
491 UINT _nxe_rtp_sender_session_aac_send(NX_RTP_SESSION *session, UCHAR *frame_data, ULONG frame_data_size,
492                                       ULONG timestamp, ULONG ntp_msw, ULONG ntp_lsw, UINT marker);
493 UINT _nx_rtp_sender_session_aac_send(NX_RTP_SESSION *session, UCHAR *frame_data, ULONG frame_data_size,
494                                      ULONG timestamp, ULONG ntp_msw, ULONG ntp_lsw, UINT marker);
495 UINT _nxe_rtp_sender_session_ssrc_get(NX_RTP_SESSION *session, ULONG *ssrc);
496 UINT _nx_rtp_sender_session_ssrc_get(NX_RTP_SESSION *session, ULONG *ssrc);
497 UINT _nxe_rtp_sender_session_vlan_priority_set(NX_RTP_SESSION *session, UINT vlan_priority);
498 UINT _nx_rtp_sender_session_vlan_priority_set(NX_RTP_SESSION *session, UINT vlan_priority);
499 
500 UINT _nxe_rtp_sender_rtcp_receiver_report_callback_set(NX_RTP_SENDER *rtp_sender, UINT (*rtcp_rr_cb)(NX_RTP_SESSION *, NX_RTCP_RECEIVER_REPORT *));
501 UINT _nx_rtp_sender_rtcp_receiver_report_callback_set(NX_RTP_SENDER *rtp_sender, UINT (*rtcp_rr_cb)(NX_RTP_SESSION *, NX_RTCP_RECEIVER_REPORT *));
502 UINT _nxe_rtp_sender_rtcp_sdes_callback_set(NX_RTP_SENDER *rtp_sender, UINT (*rtcp_sdes_cb)(NX_RTCP_SDES_INFO *));
503 UINT _nx_rtp_sender_rtcp_sdes_callback_set(NX_RTP_SENDER *rtp_sender, UINT (*rtcp_sdes_cb)(NX_RTCP_SDES_INFO *));
504 
505 #endif /* NX_RTP_SENDER_SOURCE_CODE */
506 
507 /* Determine if a C++ compiler is being used.  If so, complete the standard
508    C conditional started above.  */
509 #ifdef __cplusplus
510 }
511 #endif
512 
513 #endif /* _NX_RTP_SENDER_H_ */
514 
515