00001 /* 00002 * Copyright 2008-2010 Arsen Chaloyan 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 * 00016 * $Id: rtsp_message.h 1474 2010-02-07 20:51:47Z achaloyan $ 00017 */ 00018 00019 #ifndef RTSP_MESSAGE_H 00020 #define RTSP_MESSAGE_H 00021 00022 /** 00023 * @file rtsp_message.h 00024 * @brief RTSP Message Definition 00025 */ 00026 00027 #include "rtsp_start_line.h" 00028 #include "rtsp_header.h" 00029 00030 APT_BEGIN_EXTERN_C 00031 00032 /** RTSP message declaration */ 00033 typedef struct rtsp_message_t rtsp_message_t; 00034 00035 /** RTSP message */ 00036 struct rtsp_message_t { 00037 /** RTSP mesage type (request/response) */ 00038 rtsp_start_line_t start_line; 00039 /** RTSP header */ 00040 rtsp_header_t header; 00041 /** RTSP message body */ 00042 apt_str_t body; 00043 00044 /** Pool to allocate memory from */ 00045 apr_pool_t *pool; 00046 }; 00047 00048 /** 00049 * Create RTSP message. 00050 * @param message_type the message type 00051 * @param pool the pool to allocate memory from 00052 */ 00053 RTSP_DECLARE(rtsp_message_t*) rtsp_message_create(rtsp_message_type_e message_type, apr_pool_t *pool); 00054 00055 /** 00056 * Create RTSP request message. 00057 * @param pool the pool to allocate memory from 00058 */ 00059 RTSP_DECLARE(rtsp_message_t*) rtsp_request_create(apr_pool_t *pool); 00060 00061 /** 00062 * Create RTSP response message. 00063 * @param request the request to create response to 00064 * @param status_code the status code of the response 00065 * @param reason the reason phrase id of the response 00066 * @param pool the pool to allocate memory from 00067 */ 00068 RTSP_DECLARE(rtsp_message_t*) rtsp_response_create(const rtsp_message_t *request, rtsp_status_code_e status_code, rtsp_reason_phrase_e reason, apr_pool_t *pool); 00069 00070 /** 00071 * Destroy RTSP message 00072 * @param message the message to destroy 00073 */ 00074 RTSP_DECLARE(void) rtsp_message_destroy(rtsp_message_t *message); 00075 00076 APT_END_EXTERN_C 00077 00078 #endif /* RTSP_MESSAGE_H */