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 Streaming Protocol (RTSP) */ 18 /** */ 19 /**************************************************************************/ 20 /**************************************************************************/ 21 22 23 /**************************************************************************/ 24 /* */ 25 /* APPLICATION INTERFACE DEFINITION RELEASE */ 26 /* */ 27 /* nx_rtsp_server.h PORTABLE C */ 28 /* 6.3.0 */ 29 /* AUTHOR */ 30 /* */ 31 /* Wenhui Xie, Microsoft Corporation */ 32 /* */ 33 /* DESCRIPTION */ 34 /* */ 35 /* This file defines the NetX RTSP Server component, including all */ 36 /* data types and external references. */ 37 /* */ 38 /* RELEASE HISTORY */ 39 /* */ 40 /* DATE NAME DESCRIPTION */ 41 /* */ 42 /* 10-31-2023 Wenhui Xie Initial Version 6.3.0 */ 43 /* */ 44 /**************************************************************************/ 45 46 #ifndef NX_RTSP_SERVER_H 47 #define NX_RTSP_SERVER_H 48 49 #include "tx_api.h" 50 #include "nx_api.h" 51 52 /* Determine if a C++ compiler is being used. If so, ensure that standard 53 C is used to process the API information. */ 54 55 #ifdef __cplusplus 56 /* Yes, C++ compiler is present. Use standard C. */ 57 extern "C" { 58 59 #endif 60 61 /* Define the RTSP Server ID. */ 62 #define NX_RTSP_SERVER_ID 0x52545350UL 63 64 /* Define the RTSP protocol version of the RTSP Server. */ 65 #define NX_RTSP_VERSION_STRING "RTSP/1.0" 66 67 /* Define the RTSP SDP content type. */ 68 #define NX_RTSP_SERVER_CONTENT_TYPE_SDP "application/sdp" 69 70 /* Define the RTSP status code. */ 71 #define NX_RTSP_STATUS_CODE_OK 200 72 #define NX_RTSP_STATUS_CODE_CREATED 201 73 #define NX_RTSP_STATUS_CODE_LOW_ON_STORAGE_SPACE 250 74 #define NX_RTSP_STATUS_CODE_MULTIPLE_CHOICES 300 75 #define NX_RTSP_STATUS_CODE_MOVED_PERMANENTLY 301 76 #define NX_RTSP_STATUS_CODE_MOVED_TEMPORARILY 302 77 #define NX_RTSP_STATUS_CODE_SEE_OTHER 303 78 #define NX_RTSP_STATUS_CODE_NOT_MODIFIED 304 79 #define NX_RTSP_STATUS_CODE_USE_PROXY 305 80 #define NX_RTSP_STATUS_CODE_GOING_AWAY 350 81 #define NX_RTSP_STATUS_CODE_LOAD_BALANCING 351 82 #define NX_RTSP_STATUS_CODE_BAD_REQUEST 400 83 #define NX_RTSP_STATUS_CODE_UNAUTHORIZED 401 84 #define NX_RTSP_STATUS_CODE_PAYMENT_REQUIRED 402 85 #define NX_RTSP_STATUS_CODE_FORBIDDEN 403 86 #define NX_RTSP_STATUS_CODE_NOT_FOUND 404 87 #define NX_RTSP_STATUS_CODE_METHOD_NOT_ALLOWED 405 88 #define NX_RTSP_STATUS_CODE_NOT_ACCEPTABLE 406 89 #define NX_RTSP_STATUS_CODE_PROXY_AUTHENTICATION_REQUIRED 407 90 #define NX_RTSP_STATUS_CODE_REQUEST_TIMEOUT 408 91 #define NX_RTSP_STATUS_CODE_GONE 410 92 #define NX_RTSP_STATUS_CODE_LENGTH_REQUIRED 411 93 #define NX_RTSP_STATUS_CODE_PRECONDITION_FAILED 412 94 #define NX_RTSP_STATUS_CODE_REQUEST_ENTITY_TOO_LARGE 413 95 #define NX_RTSP_STATUS_CODE_REQUESTURI_TOO_LARGE 414 96 #define NX_RTSP_STATUS_CODE_UNSUPPORTED_MEDIA_TYPE 415 97 #define NX_RTSP_STATUS_CODE_PARAMETER_NOT_UNDERSTOOD 451 98 #define NX_RTSP_STATUS_CODE_RESERVED 452 99 #define NX_RTSP_STATUS_CODE_NOT_ENOUGH_BANDWIDTH 453 100 #define NX_RTSP_STATUS_CODE_SESSION_NOT_FOUND 454 101 #define NX_RTSP_STATUS_CODE_METHOD_NOT_VALID_IN_THIS_STATE 455 102 #define NX_RTSP_STATUS_CODE_HEADER_FIELD_NOT_VALID_FOR_RESOURCE 456 103 #define NX_RTSP_STATUS_CODE_INVALID_RANGE 457 104 #define NX_RTSP_STATUS_CODE_PARAMETER_IS_READONLY 458 105 #define NX_RTSP_STATUS_CODE_AGGREGATE_OPERATION_NOT_ALLOWED 459 106 #define NX_RTSP_STATUS_CODE_ONLY_AGGREGATE_OPERATION_ALLOWED 460 107 #define NX_RTSP_STATUS_CODE_UNSUPPORTED_TRANSPORT 461 108 #define NX_RTSP_STATUS_CODE_DESTINATION_UNREACHABLE 462 109 #define NX_RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR 500 110 #define NX_RTSP_STATUS_CODE_NOT_IMPLEMENTED 501 111 #define NX_RTSP_STATUS_CODE_BAD_GATEWAY 502 112 #define NX_RTSP_STATUS_CODE_SERVICE_UNAVAILABLE 503 113 #define NX_RTSP_STATUS_CODE_GATEWAY_TIMEOUT 504 114 #define NX_RTSP_STATUS_CODE_RTSP_VERSION_NOT_SUPPORTED 505 115 #define NX_RTSP_STATUS_CODE_OPTION_NOT_SUPPORTED 551 116 117 /* Define the RTSP Server error code. */ 118 #define NX_RTSP_SERVER_ALREADY_STARTED 0x7000 119 #define NX_RTSP_SERVER_NOT_STARTED 0x7001 120 #define NX_RTSP_SERVER_INTERNAL_ERROR 0x7002 121 #define NX_RTSP_SERVER_NO_PACKET 0x7003 122 #define NX_RTSP_SERVER_NOT_IMPLEMENTED 0x7004 123 #define NX_RTSP_SERVER_MISSING_REQUIRED_CALLBACKS 0x7005 124 #define NX_RTSP_SERVER_INVALID_REQUEST 0x7006 125 #define NX_RTSP_SERVER_INVALID_PARAMETER 0x7007 126 #define NX_RTSP_SERVER_UNSUPPORTED 0x7008 127 #define NX_RTSP_SERVER_FAILED 0x7009 128 129 /* Define the max number of concurrent Clients the Server supports. */ 130 #ifndef NX_RTSP_SERVER_MAX_CLIENTS 131 #define NX_RTSP_SERVER_MAX_CLIENTS 2 132 #endif /* NX_RTSP_SERVER_MAX_CLIENTS */ 133 134 /* Define the RTSP Server time slice. */ 135 #ifndef NX_RTSP_SERVER_TIME_SLICE 136 #define NX_RTSP_SERVER_TIME_SLICE TX_NO_TIME_SLICE 137 #endif /* NX_RTSP_SERVER_TIME_SLICE */ 138 139 /* Define the timeout for the packet allocation and data appending. */ 140 #ifndef NX_RTSP_SERVER_PACKET_TIMEOUT 141 #define NX_RTSP_SERVER_PACKET_TIMEOUT (1 * NX_IP_PERIODIC_RATE) 142 #endif /* NX_RTSP_SERVER_PACKET_TIMEOUT */ 143 144 /* Define the timeout for the RTSP Server socket accepting. */ 145 #ifndef NX_RTSP_SERVER_ACCEPT_TIMEOUT 146 #define NX_RTSP_SERVER_ACCEPT_TIMEOUT (10 * NX_IP_PERIODIC_RATE) 147 #endif /* NX_RTSP_SERVER_ACCEPT_TIMEOUT */ 148 149 /* Define the timeout for the packet sending. */ 150 #ifndef NX_RTSP_SERVER_SEND_TIMEOUT 151 #define NX_RTSP_SERVER_SEND_TIMEOUT (1 * NX_IP_PERIODIC_RATE) 152 #endif /* NX_RTSP_SERVER_SEND_TIMEOUT */ 153 154 /* Define the timeout in seconds for Client activity. */ 155 #ifndef NX_RTSP_SERVER_ACTIVITY_TIMEOUT 156 #define NX_RTSP_SERVER_ACTIVITY_TIMEOUT 60 157 #endif /* NX_RTSP_SERVER_ACTIVITY_TIMEOUT */ 158 159 /* Define the type of service. */ 160 #ifndef NX_RTSP_SERVER_TYPE_OF_SERVICE 161 #define NX_RTSP_SERVER_TYPE_OF_SERVICE NX_IP_NORMAL 162 #endif /* NX_RTSP_SERVER_TYPE_OF_SERVICE */ 163 164 /* Define the fragment option. */ 165 #ifndef NX_RTSP_SERVER_FRAGMENT_OPTION 166 #define NX_RTSP_SERVER_FRAGMENT_OPTION NX_FRAGMENT_OKAY 167 #endif /* NX_RTSP_SERVER_FRAGMENT_OPTION */ 168 169 /* Define the TTL. */ 170 #ifndef NX_RTSP_SERVER_TIME_TO_LIVE 171 #define NX_RTSP_SERVER_TIME_TO_LIVE NX_IP_TIME_TO_LIVE 172 #endif /* NX_RTSP_SERVER_TIME_TO_LIVE */ 173 174 /* Define the window size. */ 175 #ifndef NX_RTSP_SERVER_WINDOW_SIZE 176 #define NX_RTSP_SERVER_WINDOW_SIZE 8192 177 #endif /* NX_RTSP_SERVER_WINDOW_SIZE */ 178 179 /* Define the RTSP Server events. */ 180 #define NX_RTSP_SERVER_ALL_EVENTS 0xFFFFFFFF 181 #define NX_RTSP_SERVER_CONNECT_EVENT 0x00000001 182 #define NX_RTSP_SERVER_DISCONNECT_EVENT 0x00000002 183 #define NX_RTSP_SERVER_REQUEST_EVENT 0x00000004 184 #define NX_RTSP_SERVER_TIMEOUT_EVENT 0x00000008 185 186 /* Define the RTSP state. */ 187 #define NX_RTSP_STATE_INIT 1 188 #define NX_RTSP_STATE_READY 2 189 #define NX_RTSP_STATE_PLAYING 3 190 191 /* Define the transport type. */ 192 #define NX_RTSP_TRANSPORT_TYPE_UDP 0x00 193 #define NX_RTSP_TRANSPORT_TYPE_TCP 0x01 194 195 /* There are several modes of transport, see https://www.rfc-editor.org/rfc/rfc2326#section-1.6 196 1. unicast. 197 2. multicast, Server chooses address. 198 3. multicast, Client chooses address. */ 199 #define NX_RTSP_TRANSPORT_MODE_UNICAST 0x00 200 #define NX_RTSP_TRANSPORT_MODE_MULTICAST_SERVER 0x01 201 #define NX_RTSP_TRANSPORT_MODE_MULTICAST_CLIENT 0x02 202 203 /* Define Server capabilities. */ 204 #define NX_RTSP_METHOD_OPTIONS 0x00 205 #define NX_RTSP_METHOD_DESCRIBE 0x01 206 #define NX_RTSP_METHOD_SETUP 0x02 207 #define NX_RTSP_METHOD_PLAY 0x03 208 #define NX_RTSP_METHOD_PAUSE 0x04 209 #define NX_RTSP_METHOD_TEARDOWN 0x05 210 #define NX_RTSP_METHOD_SET_PARAMETER 0x06 211 #define NX_RTSP_METHOD_NOT_SUPPORT 0xFF 212 213 /* Define the transport structure. */ 214 typedef struct NX_RTSP_TRANSPORT_STRUCT 215 { 216 UCHAR transport_type; /* UDP or TCP. */ 217 218 UCHAR transport_mode; /* Unicast or multicast(Server or Client chooses address). */ 219 220 USHORT multicast_ttl; /* TTL for multicast. */ 221 222 ULONG rtp_ssrc; /* RTP SSRC. */ 223 224 USHORT client_rtp_port; /* Client RTP port. */ 225 226 USHORT client_rtcp_port; /* Client RTCP port. */ 227 228 USHORT server_rtp_port; /* Server RTP port. */ 229 230 USHORT server_rtcp_port; /* Server RTCP port. */ 231 232 NXD_ADDRESS client_ip_address; /* Client IP address. */ 233 234 NXD_ADDRESS server_ip_address; /* Server IP address. */ 235 236 UINT interface_index; /* IP interface index. */ 237 } NX_RTSP_TRANSPORT; 238 239 /* Define the response status code and description. */ 240 typedef struct NX_RTSP_RESPONSE_STRCUT 241 { 242 UINT nx_rtsp_response_code; /* The value of the response status code. */ 243 244 CHAR *nx_rtsp_response_description; /* The description of the response status code. */ 245 } NX_RTSP_RESPONSE; 246 247 /* Define the Client request structure. */ 248 typedef struct NX_RTSP_CLIENT_REQUEST_STRUCT 249 { 250 UINT nx_rtsp_client_request_method; /* OPTION/SETUP/DESCRIBE/PLAY/PAUSE/TEARDOWN/SET_PARAMETER. */ 251 252 UINT nx_rtsp_client_request_sequence_number; /* Current Client sequence number. */ 253 254 UCHAR *nx_rtsp_client_request_uri_ptr; /* Request URI name. */ 255 UINT nx_rtsp_client_request_uri_length; /* Request URI length. */ 256 257 UCHAR *nx_rtsp_client_request_range_ptr; /* Range field, needed for holding the PLAY and PAUSE method. */ 258 UINT nx_rtsp_client_request_range_length; /* Range field length. */ 259 260 ULONG nx_rtsp_client_request_session_id; /* Session id for request method. */ 261 262 UINT nx_rtsp_client_request_response_code; /* Response status code. */ 263 264 NX_RTSP_TRANSPORT nx_rtsp_client_request_transport; /* Transport structure. */ 265 } NX_RTSP_CLIENT_REQUEST; 266 267 /* Define the Client data structure. */ 268 typedef struct NX_RTSP_CLIENT_STRUCT 269 { 270 UCHAR nx_rtsp_client_valid; /* This entry is valid or not. */ 271 272 UCHAR nx_rtsp_client_state; /* The state a Client is in: INIT/READY/PLAYING. See page 77 RFC 2326. */ 273 274 UCHAR nx_rtsp_client_reserved[2]; /* Reserved. */ 275 276 NX_TCP_SOCKET nx_rtsp_client_socket; /* The socket for incoming request. */ 277 278 ULONG nx_rtsp_client_request_activity_timeout; /* Timeout for Client activity. */ 279 280 ULONG nx_rtsp_client_session_id; /* Session ID, assigned by RTSP, in host byte order. */ 281 282 struct NX_RTSP_SERVER_STRUCT *nx_rtsp_client_server_ptr; /* Pointer to the RTSP Server. */ 283 284 NX_RTSP_CLIENT_REQUEST *nx_rtsp_client_request_ptr; /* Pointer to the current Client request. */ 285 286 NX_RTSP_CLIENT_REQUEST nx_rtsp_client_request; /* The stored client request. */ 287 288 NX_PACKET *nx_rtsp_client_request_packet; /* The request packet received from Client. */ 289 290 UINT nx_rtsp_client_request_bytes_total; /* The total bytes of the request. */ 291 292 UINT nx_rtsp_client_request_content_length; /* The content length of the request. */ 293 294 NX_PACKET *nx_rtsp_client_response_packet; /* The response packet will be send to Client. */ 295 296 UINT nx_rtsp_client_npt_start; /* The start time in milliseconds of the NPT. */ 297 UINT nx_rtsp_client_npt_end; /* The end time in milliseconds of the NPT. */ 298 } NX_RTSP_CLIENT; 299 300 /* Define the method callbacks structure. */ 301 typedef struct NX_RTSP_SERVER_METHOD_CALLBACKS_STRUCT 302 { 303 UINT (*nx_rtsp_server_method_describe_callback)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length); 304 305 UINT (*nx_rtsp_server_method_setup_callback)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, NX_RTSP_TRANSPORT *transport_ptr); 306 307 UINT (*nx_rtsp_server_method_play_callback)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, UCHAR *range_ptr, UINT range_length); 308 309 UINT (*nx_rtsp_server_method_teardown_callback)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length); 310 311 UINT (*nx_rtsp_server_method_pause_callback)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, UCHAR *range_ptr, UINT range_length); 312 313 UINT (*nx_rtsp_server_method_set_parameter_callback)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, UCHAR *parameter_ptr, ULONG parameter_length); 314 } NX_RTSP_SERVER_METHOD_CALLBACKS; 315 316 /* Define the Server structure. */ 317 typedef struct NX_RTSP_SERVER_STRUCT 318 { 319 ULONG nx_rtsp_server_id; /* The ID of RTSP Server. */ 320 321 CHAR *nx_rtsp_server_name; /* The name of RTSP Server. */ 322 323 UINT nx_rtsp_server_name_length; /* The length of RTSP Server's name. */ 324 325 TX_THREAD nx_rtsp_server_thread; /* RTSP Server thread. */ 326 327 TX_TIMER nx_rtsp_server_timer; /* Timer for Client activity. */ 328 329 TX_EVENT_FLAGS_GROUP nx_rtsp_server_event_flags; /* Event flags. */ 330 331 NX_IP *nx_rtsp_server_ip_ptr; /* Pointer to the IP instance. */ 332 333 USHORT nx_rtsp_server_port; /* RTSP Server port. */ 334 335 UCHAR nx_rtsp_server_started; /* The RTSP Server is started or not. */ 336 337 UCHAR nx_rtsp_server_reserved; /* Reserved. */ 338 339 NX_PACKET_POOL *nx_rtsp_server_packet_pool; /* Packet Pool for packet allocation. */ 340 341 /* Infos recorded in RTSP Server procedures. */ 342 ULONG nx_rtsp_server_allocation_errors; 343 ULONG nx_rtsp_server_relisten_errors; 344 ULONG nx_rtsp_server_disconnection_requests; 345 UINT nx_rtsp_server_connected_client_count; 346 347 /* Data structure for all the Clients connected to the RTSP Server. */ 348 NX_RTSP_CLIENT nx_rtsp_server_client_list[NX_RTSP_SERVER_MAX_CLIENTS]; 349 350 /* The callbacks for the received methods and disconnection. */ 351 UINT (*nx_rtsp_server_disconnect_callback)(NX_RTSP_CLIENT *rtsp_client_ptr); 352 NX_RTSP_SERVER_METHOD_CALLBACKS nx_rtsp_server_method_callbacks; 353 } NX_RTSP_SERVER; 354 355 #ifndef NX_RTSP_SERVER_SOURCE_CODE 356 357 /* Application caller is present, perform API mapping. */ 358 359 /* Determine if error checking is desired. If so, map API functions 360 to the appropriate error checking front-ends. Otherwise, map API 361 functions to the core functions that actually perform the work. 362 Note: error checking is enabled by default. */ 363 #ifdef NX_DISABLE_ERROR_CHECKING 364 365 /* Services without error checking. */ 366 #define nx_rtsp_server_create _nx_rtsp_server_create 367 #define nx_rtsp_server_delete _nx_rtsp_server_delete 368 #define nx_rtsp_server_start _nx_rtsp_server_start 369 #define nx_rtsp_server_stop _nx_rtsp_server_stop 370 371 #define nx_rtsp_server_describe_callback_set _nx_rtsp_server_describe_callback_set 372 #define nx_rtsp_server_setup_callback_set _nx_rtsp_server_setup_callback_set 373 #define nx_rtsp_server_play_callback_set _nx_rtsp_server_play_callback_set 374 #define nx_rtsp_server_pause_callback_set _nx_rtsp_server_pause_callback_set 375 #define nx_rtsp_server_teardown_callback_set _nx_rtsp_server_teardown_callback_set 376 #define nx_rtsp_server_set_parameter_callback_set _nx_rtsp_server_set_parameter_callback_set 377 378 #define nx_rtsp_server_sdp_set _nx_rtsp_server_sdp_set 379 #define nx_rtsp_server_rtp_info_set _nx_rtsp_server_rtp_info_set 380 #define nx_rtsp_server_range_npt_set _nx_rtsp_server_range_npt_set 381 382 #define nx_rtsp_server_keepalive_update _nx_rtsp_server_keepalive_update 383 #define nx_rtsp_server_error_response_send _nx_rtsp_server_error_response_send 384 385 #else 386 387 /* Services with error checking. */ 388 #define nx_rtsp_server_create _nxe_rtsp_server_create 389 #define nx_rtsp_server_delete _nxe_rtsp_server_delete 390 #define nx_rtsp_server_start _nxe_rtsp_server_start 391 #define nx_rtsp_server_stop _nxe_rtsp_server_stop 392 393 #define nx_rtsp_server_describe_callback_set _nxe_rtsp_server_describe_callback_set 394 #define nx_rtsp_server_setup_callback_set _nxe_rtsp_server_setup_callback_set 395 #define nx_rtsp_server_play_callback_set _nxe_rtsp_server_play_callback_set 396 #define nx_rtsp_server_pause_callback_set _nxe_rtsp_server_pause_callback_set 397 #define nx_rtsp_server_teardown_callback_set _nxe_rtsp_server_teardown_callback_set 398 #define nx_rtsp_server_set_parameter_callback_set _nxe_rtsp_server_set_parameter_callback_set 399 400 #define nx_rtsp_server_sdp_set _nxe_rtsp_server_sdp_set 401 #define nx_rtsp_server_rtp_info_set _nxe_rtsp_server_rtp_info_set 402 #define nx_rtsp_server_range_npt_set _nxe_rtsp_server_range_npt_set 403 404 #define nx_rtsp_server_keepalive_update _nxe_rtsp_server_keepalive_update 405 #define nx_rtsp_server_error_response_send _nxe_rtsp_server_error_response_send 406 407 #endif /* NX_DISABLE_ERROR_CHECKING */ 408 409 /* Define the prototypes accessible to the application software. */ 410 411 UINT nx_rtsp_server_describe_callback_set(NX_RTSP_SERVER * rtsp_server, 412 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length)); 413 414 UINT nx_rtsp_server_setup_callback_set(NX_RTSP_SERVER * rtsp_server, 415 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, NX_RTSP_TRANSPORT *transport_ptr)); 416 417 UINT nx_rtsp_server_play_callback_set(NX_RTSP_SERVER * rtsp_server, 418 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, UCHAR *range_ptr, UINT range_length)); 419 420 UINT nx_rtsp_server_teardown_callback_set(NX_RTSP_SERVER * rtsp_server, 421 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length)); 422 423 424 UINT nx_rtsp_server_pause_callback_set(NX_RTSP_SERVER * rtsp_server, 425 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, UCHAR *range_ptr, UINT range_length)); 426 427 UINT nx_rtsp_server_set_parameter_callback_set(NX_RTSP_SERVER * rtsp_server, 428 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, UCHAR *parameter_ptr, ULONG parameter_length)); 429 430 UINT nx_rtsp_server_create(NX_RTSP_SERVER *rtsp_server_ptr, CHAR *server_name, UINT server_name_length, 431 NX_IP *ip_ptr, NX_PACKET_POOL *rtsp_packet_pool, VOID *stack_ptr, ULONG stack_size, UINT priority, UINT server_port, 432 UINT (*disconnect_callback)(NX_RTSP_CLIENT *rtsp_client_ptr)); 433 434 UINT nx_rtsp_server_delete(NX_RTSP_SERVER *rtsp_server); 435 436 UINT nx_rtsp_server_start(NX_RTSP_SERVER *rtsp_server); 437 438 UINT nx_rtsp_server_stop(NX_RTSP_SERVER *rtsp_server); 439 440 /* Called in DESCRIBE callback function to set SDP string. */ 441 UINT nx_rtsp_server_sdp_set(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *sdp_string, UINT sdp_length); 442 443 /* Called in PLAY callback function to set RTP-Info field, including the RTP sequence number and RTP timestamp. */ 444 UINT nx_rtsp_server_rtp_info_set(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *track_id, UINT track_id_len, UINT rtp_seq, UINT rtp_time); 445 446 /* Called in PLAY and PAUSE callback functions to set the NPT start and end time in Range field. */ 447 UINT nx_rtsp_server_range_npt_set(NX_RTSP_CLIENT *rtsp_client_ptr, UINT npt_start, UINT npt_end); 448 449 /* If received RTCP reports, call this API to update the keepalive timeout. https://www.rfc-editor.org/rfc/rfc2326#appendix-A.2. */ 450 UINT nx_rtsp_server_keepalive_update(NX_RTSP_CLIENT *rtsp_client_ptr); 451 452 UINT nx_rtsp_server_error_response_send(NX_RTSP_CLIENT *rtsp_client_ptr, UINT status_code); 453 454 #else 455 456 /* Define the prototypes accessible to the application software. */ 457 458 UINT _nx_rtsp_server_describe_callback_set(NX_RTSP_SERVER * rtsp_server, 459 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length)); 460 UINT _nxe_rtsp_server_describe_callback_set(NX_RTSP_SERVER * rtsp_server, 461 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length)); 462 463 UINT _nx_rtsp_server_setup_callback_set(NX_RTSP_SERVER * rtsp_server, 464 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, NX_RTSP_TRANSPORT *transport_ptr)); 465 UINT _nxe_rtsp_server_setup_callback_set(NX_RTSP_SERVER * rtsp_server, 466 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, NX_RTSP_TRANSPORT *transport_ptr)); 467 468 UINT _nx_rtsp_server_play_callback_set(NX_RTSP_SERVER * rtsp_server, 469 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, UCHAR *range_ptr, UINT range_length)); 470 UINT _nxe_rtsp_server_play_callback_set(NX_RTSP_SERVER * rtsp_server, 471 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, UCHAR *range_ptr, UINT range_length)); 472 473 UINT _nx_rtsp_server_teardown_callback_set(NX_RTSP_SERVER * rtsp_server, 474 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length)); 475 UINT _nxe_rtsp_server_teardown_callback_set(NX_RTSP_SERVER * rtsp_server, 476 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length)); 477 478 UINT _nx_rtsp_server_pause_callback_set(NX_RTSP_SERVER * rtsp_server, 479 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, UCHAR *range_ptr, UINT range_length)); 480 UINT _nxe_rtsp_server_pause_callback_set(NX_RTSP_SERVER * rtsp_server, 481 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, UCHAR *range_ptr, UINT range_length)); 482 483 484 UINT _nx_rtsp_server_set_parameter_callback_set(NX_RTSP_SERVER * rtsp_server, 485 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, UCHAR *parameter_ptr, ULONG parameter_length)); 486 UINT _nxe_rtsp_server_set_parameter_callback_set(NX_RTSP_SERVER * rtsp_server, 487 UINT (*)(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *uri, UINT uri_length, UCHAR *parameter_ptr, ULONG parameter_length)); 488 489 UINT _nx_rtsp_server_create(NX_RTSP_SERVER *rtsp_server_ptr, CHAR *server_name, UINT server_name_length, 490 NX_IP *ip_ptr, NX_PACKET_POOL *rtsp_packet_pool, VOID *stack_ptr, ULONG stack_size, UINT priority, UINT server_port, 491 UINT (*disconnect_callback)(NX_RTSP_CLIENT *rtsp_client_ptr)); 492 UINT _nxe_rtsp_server_create(NX_RTSP_SERVER *rtsp_server_ptr, CHAR *server_name, UINT server_name_length, 493 NX_IP *ip_ptr, NX_PACKET_POOL *rtsp_packet_pool, VOID *stack_ptr, ULONG stack_size, UINT priority, UINT server_port, 494 UINT (*disconnect_callback)(NX_RTSP_CLIENT *rtsp_client_ptr)); 495 496 UINT _nx_rtsp_server_delete(NX_RTSP_SERVER *rtsp_server); 497 UINT _nxe_rtsp_server_delete(NX_RTSP_SERVER *rtsp_server); 498 499 UINT _nx_rtsp_server_start(NX_RTSP_SERVER *rtsp_server); 500 UINT _nxe_rtsp_server_start(NX_RTSP_SERVER *rtsp_server); 501 502 UINT _nx_rtsp_server_stop(NX_RTSP_SERVER *rtsp_server); 503 UINT _nxe_rtsp_server_stop(NX_RTSP_SERVER *rtsp_server); 504 505 /* Called in DESCRIBE callback function to set SDP string. */ 506 UINT _nx_rtsp_server_sdp_set(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *sdp_string, UINT sdp_length); 507 UINT _nxe_rtsp_server_sdp_set(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *sdp_string, UINT sdp_length); 508 509 /* Called in PLAY callback function to set RTP-Info field, including the RTP sequence number and RTP timestamp. */ 510 UINT _nx_rtsp_server_rtp_info_set(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *track_id, UINT track_id_len, UINT rtp_seq, UINT rtp_time); 511 UINT _nxe_rtsp_server_rtp_info_set(NX_RTSP_CLIENT *rtsp_client_ptr, UCHAR *track_id, UINT track_id_len, UINT rtp_seq, UINT rtp_time); 512 513 /* Called in PLAY and PAUSE callback functions to set the NPT start and end time in Range field. */ 514 UINT _nx_rtsp_server_range_npt_set(NX_RTSP_CLIENT *rtsp_client_ptr, UINT npt_start, UINT npt_end); 515 UINT _nxe_rtsp_server_range_npt_set(NX_RTSP_CLIENT *rtsp_client_ptr, UINT npt_start, UINT npt_end); 516 517 /* If received RTCP reports, call this API to update the keepalive timeout. https://www.rfc-editor.org/rfc/rfc2326#appendix-A.2. */ 518 UINT _nx_rtsp_server_keepalive_update(NX_RTSP_CLIENT *rtsp_client_ptr); 519 UINT _nxe_rtsp_server_keepalive_update(NX_RTSP_CLIENT *rtsp_client_ptr); 520 521 UINT _nx_rtsp_server_error_response_send(NX_RTSP_CLIENT *rtsp_client_ptr, UINT status_code); 522 UINT _nxe_rtsp_server_error_response_send(NX_RTSP_CLIENT *rtsp_client_ptr, UINT status_code); 523 524 #endif /* NX_RTSP_SERVER_SOURCE_CODE */ 525 526 527 /* Determine if a C++ compiler is being used. If so, complete the standard 528 C conditional started above. */ 529 #ifdef __cplusplus 530 } 531 #endif 532 533 #endif /* NX_RTSP_SERVER_H */ 534 535