Main Page | Data Structures | File List | Data Fields | Globals

rtp_api.h

Go to the documentation of this file.
00001 /* rtp_api.h : RTP API types, structures, and functions that a user
00002                of RTP might require
00003 
00004 Copyright 1997, 1998 Lucent Technologies; all rights reserved
00005 */
00006 
00007 #ifndef _RTP_API_H
00008 #define _RTP_API_H
00009 
00010 #define BITFIELD(field, mask, shift) \
00011    (((field) & (mask)) >> (shift))
00012 #define SET_BITFIELD(field, val, mask, shift) \
00013    do { \
00014      (field) &= ~(mask); \
00015      (field) |= (((val) << (shift)) & (mask)); \
00016    } while (0)
00017   
00018 
00019 /* These  define the RTCP packet types */
00020 #define  RTCP_PACKET_SR   200
00021 #define  RTCP_PACKET_RR   201
00022 #define  RTCP_PACKET_SDES 202
00023 #define  RTCP_PACKET_BYE  203
00024 #define  RTCP_PACKET_APP  204
00025 
00026 typedef long int context;
00027 typedef long int person;
00028 
00029 /* Type sizes */
00030 typedef long int int32;
00031 typedef short int int16;
00032 typedef signed char int8;
00033 
00034 typedef unsigned long int u_int32;
00035 typedef unsigned short int u_int16;
00036 typedef unsigned char u_int8;
00037 
00038 /* memberstatus is used by the status field in the member structure
00039    to determine whether a member is currently pending, confirmed,
00040    or expired */
00041 typedef enum {
00042   RTP_MEMBER_PENDING,
00043   RTP_MEMBER_CONFIRMED,
00044   RTP_MEMBER_EXPIRED,
00045   RTP_MEMBER_PENDING_CONTRIBUTOR,
00046   RTP_MEMBER_CONFIRMED_CONTRIBUTOR,
00047   RTP_MEMBER_EXPIRED_CONTRIBUTOR
00048 } memberstatus;
00049 
00050 /* senderstatus determines state of sender. Purported means
00051    I have received an RR containing them in a report block. 
00052    Confirmed means I have actually seen a packet from them. Expired
00053    means I haven't heard from them in a while. Members
00054    move among these states identically to how they do for member
00055    state changes */
00056 
00057 typedef enum {
00058   RTP_SENDER_NOT,
00059   RTP_SENDER_PURPORTED,
00060   RTP_SENDER_CONFIRMED,
00061 } senderstatus;
00062 
00063 typedef struct {
00064   u_int32 secs;
00065   u_int32 frac;
00066 } ntp64;
00067 
00068 
00069 typedef struct {
00070   u_int8 flags;            /* Protocol version, padding flag, extension flag,
00071                               and CSRC count */
00072   u_int8 mpt;              /* marker bit and payload type */
00073   u_int16 seq;             /* sequence number */
00074   u_int32 ts;              /* timestamp */
00075   u_int32 ssrc;            /* synchronization source */
00076   u_int32 csrc[1];         /* CSRC list */
00077 } rtp_hdr_t;
00078 
00079 /* Protocol version */
00080 #define RTP_VERSION(hdr) BITFIELD((hdr).flags, 0xC0, 6)
00081 #define SET_RTP_VERSION(hdr, val) SET_BITFIELD((hdr).flags, (val), 0xC0, 6)
00082 
00083 /* Padding flag */
00084 #define RTP_P(hdr) BITFIELD((hdr).flags, 0x20, 5)
00085 #define SET_RTP_P(hdr, val) SET_BITFIELD((hdr).flags, (val), 0x20, 5)
00086 
00087 /* Extension flag */
00088 #define RTP_X(hdr) BITFIELD((hdr).flags, 0x10, 4)
00089 #define SET_RTP_X(hdr, val) SET_BITFIELD((hdr).flags, (val), 0x10, 4)
00090 
00091 /* CSRC Count */
00092 #define RTP_CC(hdr) BITFIELD((hdr).flags, 0x0F, 0)
00093 #define SET_RTP_CC(hdr, val) SET_BITFIELD((hdr).flags, (val), 0x0F, 0)
00094 
00095 /* Marker bit */
00096 #define RTP_M(hdr) BITFIELD((hdr).mpt, 0x80, 7)
00097 #define SET_RTP_M(hdr, val) SET_BITFIELD((hdr).mpt, (val), 0x80, 7)
00098 
00099 /* Marker bit */
00100 #define RTP_PT(hdr) BITFIELD((hdr).mpt, 0x7F, 0)
00101 #define SET_RTP_PT(hdr, val) SET_BITFIELD((hdr).mpt, (val), 0x7F, 0)
00102 
00103 
00104 typedef struct {           /* RTP Header Extension */
00105   u_int16 etype;           /* extension type */
00106   u_int16 elen;            /* extension length */
00107   char epayload[1];        /* extension payload */
00108 } rtp_hdr_ext;
00109 
00110 
00111 
00112 typedef struct {
00113   rtp_hdr_t *RTP_header;
00114   rtp_hdr_ext *RTP_extension;
00115   char *payload;         /* payload portion of RTP packet */
00116   long payload_len;        /* The length of the payload */
00117 } rtp_packet;
00118 
00119 
00120 
00121 typedef struct {               /* REPORT BLOCK */
00122   u_int32 ssrc;                /* ssrc identifier */
00123   unsigned int frac_lost:8;    /* Fraction lost */
00124   unsigned int cum_lost:24;    /* Cumulative pkts lost */
00125   u_int32 highest_seqno;       /* highest seqno received */
00126   u_int32 jitter;              /* interarrival jitter */
00127   u_int32 lsr;                 /* last SR timestamp */
00128   u_int32 dlsr;                /* delay since last SR */
00129 } rtcp_report_block;
00130 
00131 #define RTCP_REPORT_BLOCK_SIZE (6 * 4)
00132 
00133 
00134 
00135 typedef struct {          /* SDES item */
00136   u_int32 ssrc;           /* SSRC of the member described by the SDES item */
00137   int chunkno;            /* The index of the SDES chunk */
00138   u_int8 type;            /* SDES item type */
00139   u_int8 len;             /* SDES item length */
00140   char *description;      /* SDES item description (255 char limit) */
00141   int offset;             /* Describes the position of the type field
00142                              octet within int32: for internal use of
00143                              iterator */
00144 } rtcp_sdes_item;
00145 
00146 
00147 
00148 typedef struct {         /* BYE component */
00149   u_int32 ssrccsrc;      /* The ssrc or csrc that is leaving */
00150 } rtcp_bye_block;
00151 
00152 #define RTCP_BYE_BLOCK_SIZE 4
00153 
00154 
00155 typedef struct {                 /* Common header of RTCP packets */
00156   u_int8 flags;                  /* Protocol version, padding flags, and 
00157                                     report block count */
00158   u_int8 pt;                     /* payload type */
00159   u_int16 len;                   /* length */
00160 } rtcp_common;
00161 
00162 #define RTCP_COMMON_SIZE 4
00163 
00164 #define RTCP_VERSION(com) BITFIELD((com).flags, 0xC0, 6)
00165 #define SET_RTCP_VERSION(com, val) SET_BITFIELD((com).flags, (val), 0xC0, 6)
00166 
00167 #define RTCP_P(com) BITFIELD((com).flags, 0x20, 5)
00168 #define SET_RTCP_P(com, val) SET_BITFIELD((com).flags, (val), 0x20, 5)
00169 
00170 #define RTCP_RC(com) BITFIELD((com).flags, 0x1F, 0)
00171 #define SET_RTCP_RC(com, val) SET_BITFIELD((com).flags, (val), 0x1F, 0)
00172 
00173 typedef struct {               /* SR-specific fields -- fixed part */
00174   u_int32 ssrc;                /* SSRC of sender */
00175   u_int32 ntp_secs;            /* NTP timestamp -- integer part */
00176   u_int32 ntp_frac;            /* NTP timestamp -- fractional part */
00177   u_int32 rtp_stamp;           /* RTP timestamp */
00178   u_int32 pkt_count;           /* Sender's packet count */
00179   u_int32 oct_count;           /* Sender's octet count */
00180 } rtcp_sr;
00181 
00182 #define RTCP_SR_SIZE (6 * 4)
00183 
00184 
00185 typedef struct {
00186   u_int32 ssrc;                /* SSRC of sender */
00187 } rtcp_rr;
00188 
00189 #define RTCP_RR_SIZE 4
00190 
00191 
00192 typedef struct {
00193   u_int32 ssrccsrc; /* the ssrc or csrc */
00194   u_int32 name;     /* an ascii name */
00195 } rtcp_app;
00196 
00197 #define RTCP_APP_SIZE (2 * 4)
00198 
00199 
00200 /* An RTCP packet.  This will consist of pointers into
00201  * the actual packet. */
00202 typedef struct {                     /* RTCP Packet */
00203   rtcp_common *common;               /* Common headers */
00204 
00205   union {
00206     struct {                         /* SR specific fields */
00207       rtcp_sr *sr_fixed;
00208       rtcp_report_block *rblock[32]; /* report blocks */
00209       char* extension;
00210     } sr;
00211 
00212     struct {                         /* RR specific fields */
00213       rtcp_rr *rr_fixed;
00214       rtcp_report_block *rblock[32]; /* report blocks */
00215       char* extension;
00216     } rr;
00217 
00218     struct {
00219       char *remainder;
00220     } sdes;
00221     
00222     struct {                         /* BYE specific fields */
00223       rtcp_bye_block *byeblock[32];  /* bye SSRCs, CSRCs */
00224       u_int8 reason_length;
00225       char* reason;
00226     } bye;
00227 
00228     struct {                         /* APP specific fields */
00229       rtcp_app *app_fixed;
00230       char *appdata;                 /* application dependent data */
00231     } app;
00232 
00233     struct {
00234       char *data;
00235     } unknown;
00236 
00237   } variant;
00238 } rtcp_packet;
00239 
00240 struct link;
00241 
00242 typedef struct { /* Iterator used to walk through lists of members */
00243   struct link *cur_link;
00244   int go_forward; /* Should iterate up or down list */
00245 } member_iterator;
00246 
00247 
00248 
00249 /* receiver_report holds the information that one member reported
00250    about another in its receiver reports (SR or RR packets).
00251    We refer to the member the receiver report is describing as S (the
00252    sender), and the member who sent the receiver report as R (the
00253    receiver). */
00254 typedef struct {
00255   person reporter;        /* R's unique id */
00256   u_int8 fraction_lost;   /* fraction of packets sent by S that R lost */
00257   u_int32 cum_lost;       /* cumulative packets sent by S that R lost */
00258   u_int32 highest_seqno;  /* highest sequence # that R received from S */
00259   u_int32 jitter;         /* R's jitter calculation for SR packets from S */
00260   u_int32 last_sr;        /* LSR (last SR timestamp received at R from S:
00261                              middle 32 bits of NTP timestamp) */
00262   u_int32 delay_last_sr;  /* DLSR (delay [in units of 1/65536 seconds]
00263                              between R receiving the SR from S and R sending
00264                              the SR / RR packet */
00265 } receiver_report;
00266 
00267 
00268 /* This mirrors the definition of Tcl_HashSearch in tclHash.h, but without the
00269    types defined there, so we don't have to expose them in the API. */
00270 typedef struct hashsearch {
00271   void *table;
00272   int nextbucket;
00273   void *nextentry;
00274 } receiver_report_iterator;
00275 
00276 
00277 /* The valid range for SDES item types */
00278 typedef u_int8 memberinfo;
00279 
00280 /* Defined SDES fields. */
00281 /* These reflect the IANA registrations as of 1998-07-01 */
00282 enum {
00283   RTP_MI_CNAME = 1,
00284   RTP_MI_NAME = 2,
00285   RTP_MI_EMAIL = 3,
00286   RTP_MI_PHONE = 4,
00287   RTP_MI_LOC = 5,
00288   RTP_MI_TOOL = 6,
00289   RTP_MI_NOTE = 7,
00290   RTP_MI_PRIV = 8,
00291   RTP_MI_H323_CADDR = 9,
00292 };
00293 
00294 
00295 
00296 
00297 /* These enums define the operating modes for reconsideration.
00298    Unconditional is default, and should not generally be changed. */
00299 
00300 typedef enum {
00301   RTP_RECONSIDERATION_UNCONDITIONAL,
00302   RTP_RECONSIDERATION_CONDITIONAL,
00303   RTP_RECONSIDERATION_OFF,
00304 } reconsideration_t;
00305 
00306 /* These enums define the encryption modes supported by the library.
00307    Full encrypts all RTP and RTCP packets. Partial encrypts all RTP, but
00308    only non-SDES RTCP. None is no encryption. None is default. */
00309 
00310 typedef enum {
00311   RTP_ENCRYPTION_FULL,
00312   RTP_ENCRYPTION_PARTIAL,
00313   RTP_ENCRYPTION_NONE,
00314 } encryption_t;
00315 
00316 /* For error codes, we are making use of elemedia standard
00317 codes:
00318 
00319 Format of return codes for all APIs
00320 
00321    3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
00322   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
00323   +---+-----------+---------------+-------------------------------+
00324   |Sev| Facility  | Fac-Sub-Code  |               Code            |
00325  +---+-----------+---------------+-------------------------------+
00326 
00327   where
00328 
00329       Sev - is the severity code (2 bits)
00330 
00331           00 - Success
00332           01 - Informational
00333           10 - Warning
00334           11 - Error
00335 
00336       R - is a reserved bit   (2 bits)
00337 
00338       Facility - is the facility code ( 6 bits)
00339 
00340               Fac-Sub-Code - is the facility sub code.
00341 
00342       Code - is the facility's status code (16 bits)
00343 
00344       */
00345 
00346 
00347 #define EM_MASK(BITS,SHIFT)     (((1U << (BITS)) - 1) << (SHIFT))
00348 
00349 #define EM_CODE_SHIFT                           0U
00350 #define EM_CODE_BITS                            16U
00351 #define EM_CODE_MASK                            EM_MASK(EM_CODE_BITS,EM_CODE_SHIFT)
00352 
00353 #define EM_FACILITY_SUB_CODE_SHIFT       16U
00354 #define EM_FACILITY_SUB_CODE_BITS        8U
00355 #define EM_FACILITY_SUB_CODE_MASK        EM_MASK(EM_FACILITY_SUB_CODE_BITS,\
00356                                                                                         EM_FACILITY_SUB_CODE_SHIFT)
00357 #define EM_FACILITY_CODE_SHIFT          24U
00358 #define EM_FACILITY_CODE_BITS           6U
00359 #define EM_FACILITY_CODE_MASK           EM_MASK(EM_FACILITY_CODE_BITS,\
00360                                                                                         EM_FACILITY_CODE_SHIFT)
00361 #define EM_SEVERITY_SHIFT                       30U
00362 #define EM_SEVERITY_BITS                        2U
00363 #define EM_SEVERITY_MASK                        EM_MASK(EM_SEVERITY_BITS,\
00364                                                                                 EM_SEVERITY_SHIFT)
00365 
00366 /* Severity codes */
00367 
00368 #define EM_SEVERITY_SUCCESS               0U
00369 #define EM_SEVERITY_INFORMATIONAL         1U
00370 #define EM_SEVERITY_WARNING               2U
00371 #define EM_SEVERITY_ERROR                 3U
00372 
00373  /* List of codes common to all modules */
00374 
00375 #define EM_PENDING                                        1U
00376 #define EM_INVALID_PARAM                          2U    /* wrong parameter passed               */
00377 #define EM_NOT_IMPLEMENTED                        3U    /* for protocol features.               */
00378 #define EM_MEM_ALLOC_FAILED                       4U    /* not enough memory                    */
00379 #define EM_UNKNOWN_ERROR                          5U    /* no specific error code               */
00380 #define EM_NOT_SUPPORTED                          6U    /* for invalid operations               */
00381 #define EM_NOT_PRESENT                            7U    /* could not get requested item */
00382 #define EM_BUFFER_TOO_SMALL                       8U    /* too little space supplied    */
00383 #define EM_SOFTWARE_EXPIRED                       9U    /* s/w evaluation period expired*/
00384 #define EM_INVALID_FSM_STIMULUS          10U    /* stim incompatible with state */
00385 #define EM_INVALID_RESULT_ARG            11U    /* msgPtr in result not set     */
00386 #define EM_LIBRARY_NOT_INTIALIZED        12U    /* InitLibrary not called               */
00387 #define EM_INSUFFICIENT_INFO             13U    /* not enough information supplied*/
00388 #define EM_INVALID_SEQ_NUMBER            14U    /* sequence number mismatch     */
00389 #define EM_FSM_NO_OPERATION                      15U    /* state machine stim caused NOOP*/
00390 #define EM_CODE_MAX                             256U
00391 
00392 /*
00393  * Well known facility codes
00394  */
00395 
00396 #define FACILITY_RTP                              3U
00397 
00398 #define EM_STATUS(SEV,FAC,SUB,CODE)\
00399         (((SEV) << EM_SEVERITY_SHIFT) & EM_SEVERITY_MASK) |\
00400         (((FAC) << EM_FACILITY_CODE_SHIFT) & EM_FACILITY_CODE_MASK)     |\
00401         (((SUB) << EM_FACILITY_SUB_CODE_SHIFT) & EM_FACILITY_SUB_CODE_MASK) |\
00402         (((CODE) << EM_CODE_SHIFT) & EM_CODE_MASK)
00403 
00404 #define RTP_SUCC(CODE)   EM_STATUS(EM_SEVERITY_SUCCESS, FACILITY_RTP, 0, CODE)
00405 #define RTP_WARN(CODE)   EM_STATUS(EM_SEVERITY_SUCCESS, FACILITY_RTP, 0, CODE)
00406 #define RTP_INFO(CODE)   EM_STATUS(EM_SEVERITY_SUCCESS, FACILITY_RTP, 0, CODE)
00407 #define RTP_ERR(CODE)   EM_STATUS(EM_SEVERITY_SUCCESS, FACILITY_RTP, 0, CODE)
00408 
00409 
00410 
00411 #define EM_RTP_TOO_MANY_CONTEXTS                    (EM_CODE_MAX + 1)
00412 #define EM_RTP_UNKNOWN_CONTEXT                      (EM_CODE_MAX + 2)
00413 #define EM_RTP_NOSOCKET                             (EM_CODE_MAX + 3)
00414 #define EM_RTP_CANT_GET_SOCKET                      (EM_CODE_MAX + 4)
00415 #define EM_RTP_CANT_BIND_SOCKET                     (EM_CODE_MAX + 5)
00416 #define EM_RTP_CANT_SET_SOCKOPT                     (EM_CODE_MAX + 6)
00417 #define EM_RTP_SOCKET_WRITE_FAILURE                 (EM_CODE_MAX + 7)
00418 #define EM_RTP_SOCKET_READ_FAILURE                  (EM_CODE_MAX + 8)
00419 #define EM_RTP_SOCKET_MISMATCH                      (EM_CODE_MAX + 9)
00420 #define EM_RTP_FIXED_WHEN_OPEN                      (EM_CODE_MAX + 10)
00421 #define EM_RTP_BAD_ADDR                             (EM_CODE_MAX + 11)
00422 #define EM_RTP_BAD_PORT                             (EM_CODE_MAX + 12)
00423 #define EM_RTP_CANT_SEND                            (EM_CODE_MAX + 13)
00424 #define EM_RTP_CANT_CLOSE_SESSION                   (EM_CODE_MAX + 14)
00425 #define EM_RTP_BAD_MI                               (EM_CODE_MAX + 15)
00426 #define EM_RTP_BAD_PROFILE                          (EM_CODE_MAX + 16)
00427 #define EM_RTP_SOCKET_EMPTY                         (EM_CODE_MAX + 17)
00428 #define EM_RTP_PACKET_LOOPBACK                      (EM_CODE_MAX + 18)
00429 #define EM_RTP_CSRC_LIST_NOT_SET                    (EM_CODE_MAX + 19)
00430 #define EM_RTP_CSRC_APPEARS_TWICE                   (EM_CODE_MAX + 20)
00431 #define EM_RTP_BAD_PACKET_FORMAT                    (EM_CODE_MAX + 21)
00432 #define EM_RTP_NO_SUCH_PERSON                       (EM_CODE_MAX + 22)
00433 #define EM_RTP_PERSON_DATA_PROTECTED                (EM_CODE_MAX + 23)
00434 #define EM_RTP_NO_SUCH_SENDER                       (EM_CODE_MAX + 24)
00435 #define EM_RTP_NO_SUCH_SDES                         (EM_CODE_MAX + 25)
00436 #define EM_RTP_CANT_USE_ENCRYPTION                  (EM_CODE_MAX + 26)
00437 #define EM_RTP_DECRYPTION_FAILURE                   (EM_CODE_MAX + 27)
00438 #define EM_RTP_END_OF_LIST                          (EM_CODE_MAX + 28)
00439 #define EM_RTP_CANT_CALL_FUNCTION                   (EM_CODE_MAX + 29)
00440 #define EM_RTP_SSRC_IN_USE                          (EM_CODE_MAX + 30)
00441 #define EM_RTP_CANT_GETSOCKNAME                     (EM_CODE_MAX + 31)
00442 #define EM_RTP_NO_SUCH_CONTRIBUTOR                  (EM_CODE_MAX + 32)
00443 #define EM_RTP_CSRC_LIST_FULL                       (EM_CODE_MAX + 33)
00444 #define EM_RTP_DONT_SEND_NOW                        (EM_CODE_MAX + 34)
00445 #define EM_RTP_CANT_SEND_BYE                        (EM_CODE_MAX + 35)
00446 
00447 
00448 
00449 typedef enum {
00450   RTP_OK =                   0,                                   /* No error */
00451   RTP_CANT_ALLOC_MEM =       RTP_ERR(EM_MEM_ALLOC_FAILED),         /* Memory allocation failed */
00452   RTP_TOO_MANY_CONTEXTS =    RTP_ERR(EM_RTP_TOO_MANY_CONTEXTS), /* Max # of contexts exceeded */
00453   RTP_UNKNOWN_CONTEXT =      RTP_ERR(EM_RTP_UNKNOWN_CONTEXT),         /* Context never created, or destroyed */
00454   RTP_NOSOCKET =             RTP_ERR(EM_RTP_NOSOCKET),                /* Socket not open for r/w */
00455   RTP_CANT_GET_SOCKET =      RTP_ERR(EM_RTP_CANT_GET_SOCKET),           /* Can't obtain a new socket */
00456   RTP_CANT_BIND_SOCKET =     RTP_ERR(EM_RTP_CANT_BIND_SOCKET),          /* Can't bind the socket */
00457   RTP_CANT_SET_SOCKOPT =     RTP_ERR(EM_RTP_CANT_SET_SOCKOPT),          /* Unable to set certain socket options */
00458   RTP_SOCKET_WRITE_FAILURE = RTP_ERR(EM_RTP_SOCKET_WRITE_FAILURE),      /* Unable to write to a socket */
00459   RTP_SOCKET_READ_FAILURE =  RTP_ERR(EM_RTP_SOCKET_READ_FAILURE),       /* Unable to read from a socket */
00460   RTP_SOCKET_MISMATCH =      RTP_ERR(EM_RTP_SOCKET_MISMATCH),           /* Socket does not belong to session */
00461   RTP_FIXED_WHEN_OPEN =      RTP_ERR(EM_RTP_FIXED_WHEN_OPEN),           /* change not allowed during open session */
00462   RTP_BAD_ADDR =             RTP_ERR(EM_RTP_BAD_ADDR),                 /* The address specified is bad */
00463   RTP_BAD_PORT =             RTP_ERR(EM_RTP_BAD_PORT),                 /* The port specified is bad */
00464   RTP_CANT_SEND =            RTP_ERR(EM_RTP_CANT_SEND),         /* Sending packets not allowed because
00465                                                                            destination address was never set */
00466   RTP_CANT_CLOSE_SESSION =   RTP_ERR(EM_RTP_CANT_CLOSE_SESSION),       /* Unable to close the current session */
00467   RTP_BAD_MI =               RTP_ERR(EM_RTP_BAD_MI),                   /* No such membership info */
00468   RTP_BAD_PROFILE =          RTP_ERR(EM_RTP_BAD_PROFILE),              /* Invalid rtpprofile specified */
00469   RTP_SOCKET_EMPTY =         RTP_WARN(EM_RTP_SOCKET_EMPTY),             /* no data to receive at socket */
00470   RTP_PACKET_LOOPBACK =      RTP_WARN(EM_RTP_PACKET_LOOPBACK),          /* packet sent from local address with
00471                                                                            SSRC identical to current SSRC or 
00472                                                                            identical to the previous SSRC
00473                                                                            (before a collision).  i.e. it
00474                                                                            is believed the packet looped back */
00475                         
00476   RTP_INSUFFICIENT_BUFFER =  RTP_ERR(EM_BUFFER_TOO_SMALL),      /* allocated buffer too small */
00477   RTP_CSRC_LIST_NOT_SET =    RTP_ERR(EM_RTP_CSRC_LIST_NOT_SET), /* CSRC list not yet set */
00478   RTP_CSRC_APPEARS_TWICE=    RTP_WARN(EM_RTP_CSRC_APPEARS_TWICE),       /* 2 CSRCs on list have same SSRC */
00479   RTP_BAD_PACKET_FORMAT =    RTP_WARN(EM_RTP_BAD_PACKET_FORMAT),        /* Packet has incorrect format */
00480   RTP_NO_SUCH_PERSON =       RTP_ERR(EM_RTP_NO_SUCH_PERSON),           /* Person not session member */
00481   RTP_PERSON_DATA_PROTECTED =RTP_ERR(EM_RTP_PERSON_DATA_PROTECTED) ,    /* Not allowed to alter this field of data
00482                                                                            for this person */
00483   RTP_NO_SUCH_SENDER =       RTP_ERR(EM_RTP_NO_SUCH_SENDER),           /* No such sender in current session */
00484   RTP_NO_SUCH_SDES =         RTP_ERR(EM_RTP_NO_SUCH_SDES),             /* No such SDES field */
00485   RTP_CANT_USE_ENCRYPTION =  RTP_ERR(EM_RTP_CANT_USE_ENCRYPTION),       /* Encryption /decryption cannot be used
00486                                                                            because the encryption / decryption
00487                                                                            functions were not set. */
00488   RTP_DECRYPTION_FAILURE =   RTP_ERR(EM_RTP_DECRYPTION_FAILURE),       /* Packet was unsuccessfully decrypted */
00489   RTP_END_OF_LIST =          RTP_INFO(EM_RTP_END_OF_LIST),              /* Called by iterator when no more members
00490                                                                              exist on the list */
00491   RTP_CANT_CALL_FUNCTION =   RTP_WARN(EM_RTP_CANT_CALL_FUNCTION),       /* Function call not allowed at this
00492                                                                            time (to prevent recursion that would
00493                                                                            cause side effects) */
00494   RTP_SSRC_IN_USE =          RTP_WARN(EM_RTP_SSRC_IN_USE),              /* Attempt to create a CSRC with an
00495                                                                            SSRC value already used in the CSRC
00496                                                                            list */
00497   RTP_CANT_GETSOCKNAME =     RTP_ERR(EM_RTP_CANT_GETSOCKNAME),         /* Couldn't get socket name */
00498   RTP_BAD_VALUE =            RTP_ERR(EM_INVALID_PARAM),                /* Parameter out of range */
00499   RTP_NO_SUCH_CONTRIBUTOR =  RTP_ERR(EM_RTP_NO_SUCH_CONTRIBUTOR),      /* CSRC List member set to someone
00500                                                                             not a contributor */
00501   RTP_CSRC_LIST_FULL =       RTP_ERR(EM_RTP_CSRC_LIST_FULL),           /* The CSRC list has 15 members */
00502   RTP_DONT_SEND_NOW =        RTP_INFO(EM_RTP_DONT_SEND_NOW),            /* A packet was reconsidered and should be
00503                                                                              sent later */
00504   RTP_ERROR_CANT_SEND_BYE =  RTP_INFO(EM_RTP_CANT_SEND_BYE)             /* An attempt was made to send a BYE packet
00505                                                                            when no RTP or RTCP has been sent previously */
00506 } rtperror;
00507 
00508 
00509 typedef enum {
00510 RTP_FLAG_NEW_MEMBER,              /* New Member(s) joined session */
00511 RTP_FLAG_NEW_SENDER,              /* Member (re)started sending */
00512 RTP_FLAG_EXPIRED_MEMBER,          /* Member(s) expired from session */
00513 RTP_FLAG_EXPIRED_SENDER,          /* Member(s) expired as senders, and are
00514                                      now purported */
00515 RTP_FLAG_MEMBER_LEAVES,           /* Member(s) sent BYE packet */
00516 RTP_FLAG_OBSERVE_COLLISION,       /* Collision detected */
00517 RTP_FLAG_A_CSRC_COLLIDES,         /* Member(s) have same SSRC as a
00518                                      member in local CSRC list */
00519 RTP_FLAG_UNIQUE_ID_REMAP,         /* A member involved in a collision
00520                                      returned to the session with
00521                                      a new SSRC and was initially
00522                                      thought to be a new member,
00523                                      and was assigned another
00524                                      unique ID.  It has just
00525                                      been realized that this
00526                                      is in fact not a new member,
00527                                      and so the API will revert
00528                                      to using the original unique
00529                                      ID for the member. */
00530 RTP_FLAG_MEMBER_INFO_CHANGES,     /* One of a member's SDES fields
00531                                      has changed. */
00532 RTP_FLAG_MEMBER_ALIVE,            /* The member's liveness status
00533                                      has changed from expired to confirmed. */
00534 RTP_FLAG_MEMBER_CONFIRMED,        /* The members status has changed from
00535                                      pending to confirmed */
00536 RTP_FLAG_DELETED_PENDING,         /* A pending member has been deleted 
00537                                      due to soft timeout */
00538 RTP_FLAG_DELETED_MEMBER,          /* An expired member has been deleted */
00539 RTP_FLAG_ADDRESS_CHANGES,         /* A member's IP address has changed. */
00540 RTP_FLAG_COLLIDE_WITH_ME,         /* There is a collision between some member and
00541                                      the local member */
00542 RTP_FLAG_PURPORTED_SENDER,        /* Information has been received indicating this
00543                                      user is a sender, although no data packets
00544                                      have yet been received for them */
00545 RTP_FLAG_DELETED_SENDER,          /* All state information associated with this
00546                                              sender is now destroyed */
00547 RTP_FLAG_NONE
00548 } rtpflag;
00549 
00550 rtperror RTPSessionSetRTPStampRate(context cid, int32 payload_type,
00551         int32 usec);
00552 rtperror RTPSessionGetRTPStampRate(context cid, int32 payload_type,
00553         int32 *usec);
00554 
00555 rtperror RTPSessionSetKey(context cid, void* value);
00556 rtperror RTPSessionGetKey(context cid, void** value);
00557 
00558 rtperror RTPSessionSetReconsideration(context cid, reconsideration_t value);
00559 rtperror RTPSessionGetReconsideration(context cid, reconsideration_t *value);
00560 
00561 rtperror RTPSessionSetExtension(context cid, rtp_hdr_ext *the_ext);
00562 rtperror RTPSessionGetExtension(context cid, rtp_hdr_ext **the_ext);
00563 
00564 rtperror RTPSessionSetBandwidth(context cid, float session_bwidth,
00565                                 float rtcp_fraction);
00566 rtperror RTPSessionGetBandwidth(context cid, float *session_bwidth,
00567                                 float *rtcp_fraction);
00568 
00569 rtperror RTPSessionSetUserInfo(context cid, void* info);
00570 rtperror RTPSessionGetUserInfo(context cid, void** info);
00571 
00572 rtperror RTPSessionAddToCSRCList(context cid, u_int32 ssrc);
00573 rtperror RTPSessionRemoveFromCSRCList(context cid, u_int32 ssrc);
00574 rtperror RTPSessionAddToContributorList(context cid, u_int32 ssrc);
00575 /* RemoveFromContributorList is either high-level or low-level */
00576 
00577 rtperror RTPSessionGetCSRCList(context cid, u_int32 *value, int32 *size);
00578 
00579 rtperror RTPSessionGetUniqueIDForCSRC(context cid, u_int32 ssrc, person *p);
00580 
00581 rtperror RTPSessionGetMemberList(context cid, member_iterator *iter);
00582 rtperror RTPSessionGetMemberListLen(context cid, long *the_len);
00583 
00584 rtperror RTPSetUpdateMemberCallBack(context cid,
00585         void (*f)(context, person, rtpflag, char *));
00586 
00587 rtperror RTPSetChangedMemberInfoCallBack(context cid,
00588         void (*f)(context, person, memberinfo, char*, rtpflag));
00589 
00590 rtperror RTPSetCollidedMemberCallBack(context cid, 
00591         void (*f)(context, person, person, rtpflag));
00592 
00593 rtperror RTPSetRevertingIDCallBack(context cid, 
00594         void (*f)(context, person, person, void*, rtpflag));
00595 
00596 rtperror RTPCurrentMember(context cid, member_iterator *iter,
00597                                 person *the_member);
00598 rtperror RTPNextMember(context cid, member_iterator *iter,
00599                                 person *the_member);
00600 
00601 
00602 
00603 
00604 rtp_packet RTPGetRTPPacket(char *rtppacket, long pktlen);
00605 u_int32 RTPPacketGetCSRC(rtp_packet *rtppkt, int csrc_no);
00606 
00607 int RTPSplitCompoundRTCP(char *rtcppacket, char *indpkts[], long len);
00608 rtcp_packet RTPGetRTCPPacket(char *rtcppacket);
00609 void GetFirstSDESItemForSSRC(rtcp_sdes_item *the_item, char* startpoint);
00610 rtcp_sdes_item InitSDESItemIter(rtcp_packet *rtcpsdes);
00611 rtcp_sdes_item GetNextItem(rtcp_sdes_item *prev_item);
00612 
00613 
00614 rtcp_report_block RTPGetReportBlock(rtcp_packet *rtcprrsr, int blockno);
00615 
00616 rtcp_bye_block RTPGetByeBlock(rtcp_packet *rtcpbye, int blockno);
00617 
00618 rtperror RTPMemberInfoGetStatus(context cid, person p, memberstatus *s, senderstatus *sender );
00619 
00620 rtperror RTPMemberInfoSetSDES(context cid, person p, memberinfo SDES_field,
00621         char *the_info);
00622 rtperror RTPMemberInfoGetSDES(context cid, person p, memberinfo SDES_field,
00623         char *the_info);
00624 
00625 
00626 
00627 rtperror RTPMemberInfoSetNTP(context cid, person p, 
00628                              ntp64 NTP_time);
00629         
00630 rtperror RTPMemberInfoGetNTP(context cid, person p,
00631                              ntp64 *NTP_time);
00632 
00633 
00634 rtperror RTPMemberInfoSetRTP(context cid, person p, 
00635                 int32 rtp_stamp);
00636         
00637 rtperror RTPMemberInfoGetRTP(context cid, person p,
00638          int32 *RTP_time);
00639 
00640 
00641 rtperror RTPMemberInfoSetPktCount(context cid, person p, 
00642                 int32 count);
00643         
00644 rtperror RTPMemberInfoGetPktCount(context cid, person p,
00645          int32 *count);
00646 
00647 
00648 rtperror RTPMemberInfoSetRTCPPktCount(context cid, person p, int32 count);
00649         
00650 rtperror RTPMemberInfoGetRTCPPktCount(context cid, person p, int32 *count);
00651 
00652 
00653 rtperror RTPMemberInfoSetOctCount(context cid, person p, 
00654                 int32 count);
00655         
00656 rtperror RTPMemberInfoGetOctCount(context cid, person p,
00657          int32 *count);
00658 
00659 rtperror RTPMemberInfoSetSSRC(context cid, u_int32 ssrc, u_int32 mask);
00660         
00661 rtperror RTPMemberInfoGetSSRC(context cid, person p,
00662          u_int32 *ssrc);
00663 
00664 rtperror RTPMemberInfoSetUserInfo(context cid, person p, 
00665                 void* info);
00666         
00667 rtperror RTPMemberInfoGetUserInfo(context cid, person p,
00668                 void** info);
00669 
00670 
00671 
00672 rtperror RTPSenderInfoGetFirstReceiverReport(context cid, person p,
00673          receiver_report_iterator *the_iterator, receiver_report *report);
00674 
00675 rtperror RTPSenderInfoGetNextReceiverReport(context cid, person p,
00676          receiver_report_iterator *the_iterator, receiver_report *report);
00677 
00678 
00679 rtperror RTPSenderInfoGetLocalReception(context cid, person p,
00680          receiver_report *report);
00681 
00682 
00683 rtperror RTPFindMember(context cid, memberinfo mi, char *sdes_field,
00684                  person *p);
00685 
00686 
00687 rtperror RTPMostRecentRTPTime(context cid, person p,
00688                               struct timeval *the_time);
00689 rtperror RTPMostRecentRTCPTime(context cid, person p,
00690                               struct timeval *the_time);
00691 rtperror RTPMostRecentRTPPerson(context cid, person *p);
00692 rtperror RTPMostRecentRTCPPerson(context cid, person *p);
00693 
00694 
00695 
00696 char *RTPStrError(rtperror err);
00697 
00698 char *RTPDebugStr(void);
00699 #endif
00700 

Generated on Mon Apr 5 16:35:08 2004 for dvsend by doxygen 1.3.5