00001 /* 00002 This file is part of FreeSDP 00003 Copyright (C) 2001,2002,2003,2004 Federico Montesino Pouzols <fedemp@altern.org> 00004 00005 FreeSDP is free software; you can redistribute it and/or modify it 00006 under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 FreeSDP is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00019 00026 #ifndef FSDP_PRIV_H 00027 #define FSDP_PRIV_H 00028 00029 #define _GNU_SOURCE 00030 00031 #ifdef HAVE_CONFIG_H 00032 # include <config.h> 00033 # if STDC_HEADERS 00034 # include <stdio.h> 00035 # include <stdlib.h> 00036 # include <string.h> 00037 # else 00038 # if !HAVE_STRDUP 00039 # error "Portability problem: strdup was not found in this system" 00040 # endif 00041 # if !HAVE_STRTOUL 00042 # error "Portability problem: strtoul was not found in this system" 00043 # endif 00044 # endif 00045 /* strtof is C99 but not ANSI C. It does not appear in stock FreeBSD 00046 4.6. strtod is ANSI C. */ 00047 # if !HAVE_STRTOF 00048 # define strtof(a,b) strtod(a,b) 00049 # endif 00050 #endif 00051 00052 #include <freesdp/common.h> 00053 00054 #define NTP_EPOCH_OFFSET 2208988800UL 00055 00056 #define FSDP_MAX_LENGTH 2000 00057 00058 /* Tags for doxygen documentation */ 00059 00079 /* Private routines declarations */ 00080 00081 BEGIN_C_DECLS 00082 00089 typedef struct { 00090 fsdp_bw_modifier_type_t b_mod_type; 00091 unsigned long int b_value; 00092 char *b_unknown_bw_modt; 00093 } fsdp_bw_modifier_t; 00094 00101 typedef struct { 00102 char *pt; 00103 char *encoding_name; 00104 unsigned int clock_rate; 00105 char *parameters; 00106 } fsdp_rtpmap_t; 00107 00114 typedef struct fsdp_connection_address_t_s { 00115 char *address; 00116 unsigned int address_ttl; 00117 unsigned int address_count; 00118 } fsdp_connection_address_t; 00119 00123 struct fsdp_media_description_t_s { 00124 /* from `m=<media> <port> <transport> <fmt list>' line */ 00125 fsdp_media_t media_type; 00126 unsigned int port; 00127 unsigned int port_count; 00128 fsdp_transport_protocol_t transport; 00129 char **formats; 00130 unsigned int formats_count; 00131 /* from i=<media title> */ 00132 char *i_title; 00133 /* from `c=<network type> <address type> <connection address>' line 00134 (optional) */ 00135 fsdp_network_type_t c_network_type; 00136 fsdp_address_type_t c_address_type; 00137 fsdp_connection_address_t c_address; 00138 /* from `b=<modifier>:<bandwidth-value>' lines (optional) */ 00139 fsdp_bw_modifier_t *bw_modifiers; 00140 unsigned int bw_modifiers_count; 00141 /* from `k=<method>' or `k=<method>:<encryption key>' line 00142 (optional) */ 00143 fsdp_encryption_method_t k_encryption_method; 00144 char *k_encryption_content; 00145 /* from `a=<attribute>' or `a=<attribute>:<value>' lines (opt) */ 00146 unsigned long int a_ptime; 00147 unsigned long int a_maxptime; 00148 /* rtpmap */ 00149 fsdp_rtpmap_t **a_rtpmaps; 00150 unsigned int a_rtpmaps_count; 00151 fsdp_orient_t a_orient; 00152 fsdp_sendrecv_mode_t a_sendrecv_mode; 00153 char **a_sdplangs; 00154 unsigned int a_sdplangs_count; 00155 char **a_langs; 00156 unsigned int a_langs_count; 00157 float a_framerate; 00158 unsigned int a_quality; 00159 char **a_fmtps; 00160 unsigned int a_fmtps_count; 00161 /* rtcp attribute */ 00162 unsigned int a_rtcp_port; 00163 fsdp_network_type_t a_rtcp_network_type; 00164 fsdp_address_type_t a_rtcp_address_type; 00165 char *a_rtcp_address; 00166 /* media attributes that are not directly supported */ 00167 char **unidentified_attributes; 00168 unsigned int unidentified_attributes_count; 00169 }; 00170 00171 typedef struct fsdp_media_description_t_s fsdp_media_announcement_t; 00172 00176 typedef struct { 00177 /* times in seconds */ 00178 unsigned long int interval; 00179 unsigned long int duration; 00180 unsigned long int *offsets; 00181 unsigned int offsets_count; 00182 } fsdp_repeat_t; 00183 00190 typedef struct { 00191 time_t start; 00192 time_t stop; 00193 fsdp_repeat_t **repeats; 00194 unsigned int repeats_count; 00195 } fsdp_time_period_t; 00196 00200 struct fsdp_description_t_s 00201 { 00202 /* from v=... line */ 00203 unsigned int version; 00204 /* from o=... line */ 00205 char *o_username; 00206 char *o_session_id; 00207 char *o_announcement_version; 00208 fsdp_network_type_t o_network_type; 00209 fsdp_address_type_t o_address_type; 00210 char *o_address; 00211 /* from s=... line */ 00212 char *s_name; 00213 /* from i=... line (opt) */ 00214 char *i_information; 00215 /* from u=... line (opt) */ 00216 char *u_uri; 00217 /* from e=... lines (0 or more) */ 00218 const char **emails; 00219 unsigned int emails_count; 00220 /* from p=... lines (0 or more) */ 00221 const char **phones; 00222 unsigned int phones_count; 00223 /* from `c=<network type> <address type> <connection address>' line */ 00224 fsdp_network_type_t c_network_type; 00225 fsdp_address_type_t c_address_type; 00226 fsdp_connection_address_t c_address; 00227 /* from `b=<modifier>:<bandwidth-value>' lines (optional) */ 00228 fsdp_bw_modifier_t *bw_modifiers; 00229 unsigned int bw_modifiers_count; 00230 /* from `t=<start time> <stop time>' lines (1 or more)*/ 00231 /* from `r=<repeat interval> <active duration> <list of offsets from 00232 start-time>' */ 00233 fsdp_time_period_t **time_periods; 00234 unsigned int time_periods_count; 00235 /* from `z=<adjustment time> <offset> <adjustment time> <offset> 00236 ....' lines */ 00237 char *timezone_adj; 00238 /* from `k=<method>' or `k=<method>:<encryption key>' line (opt) */ 00239 fsdp_encryption_method_t k_encryption_method; 00240 char *k_encryption_content; 00241 /* from `a=<attribute>' or `a=<attribute>:<value>' lines (opt) */ 00242 /* Currently, includes category, keywords, tool and charset */ 00243 char *a_str_attributes[FSDP_LAST_SESSION_STR_ATT + 1]; 00244 /* rtpmap */ 00245 fsdp_rtpmap_t **a_rtpmaps; 00246 unsigned int a_rtpmaps_count; 00247 fsdp_sendrecv_mode_t a_sendrecv_mode; 00248 fsdp_session_type_t a_type; 00249 char **a_sdplangs; 00250 unsigned int a_sdplangs_count; 00251 char **a_langs; 00252 unsigned int a_langs_count; 00253 /* from `m=<media> <port>/<number of ports> <transport> <fmt list>' 00254 lines [one or more] */ 00255 fsdp_media_announcement_t **media_announcements; 00256 unsigned int media_announcements_count; 00257 /* session attributes that are not directly supported */ 00258 char **unidentified_attributes; 00259 unsigned int unidentified_attributes_count; 00260 }; 00261 00262 #define MEDIA_RTPMAPS_MAX_COUNT 10 00263 #define SDPLANGS_MAX_COUNT 10 00264 #define UNIDENTIFIED_ATTRIBUTES_MAX_COUNT 10 00265 00266 END_C_DECLS 00267 00268 #endif /* FSDP_PRIV_H */