⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtp.h

📁 用C实现的在LINUX系统下的聊天程序.无需登录就可以下载
💻 H
📖 第 1 页 / 共 2 页
字号:
} rtcp_sdes_item_t;/* RTCP SDES */typedef struct {  uint32_t ssrc;                /* SSRC/CSRC identifier                   */  rtcp_sdes_item_t item[1];     /* SDES items                             */} rtcp_sdes_t;/* RTCP BYE */typedef struct {  uint8_t rlen;                 /* reason length                          */  char *reason;                 /* reason for leaving                     */#ifdef WORDS_BIGENDIAN  unsigned int ver: 2;          /* RTP version                            */  unsigned int p: 1;            /* padding flag                           */  unsigned int sc: 5;           /* source count                           */#else  unsigned int sc: 5;           /* source count                           */  unsigned int p: 1;            /* padding flag                           */  unsigned int ver: 2;          /* RTP version                            */#endif  uint8_t pt;                   /* packet type                            */  uint16_t len;                 /* length of rtcp packet                  */  uint32_t ssrc[1];             /* SSRC/CSRC identifier                   */} rtcp_bye_t;/* RTCP APP */typedef struct {  char *data;                   /* application-dependent data             */#ifdef WORDS_BIGENDIAN  unsigned int ver: 2;          /* RTP version                            */  unsigned int p: 1;            /* padding flag                           */  unsigned int subtype: 5;      /* subtype                                */#else  unsigned int subtype: 5;      /* subtype                                */  unsigned int p: 1;            /* padding flag                           */  unsigned int ver: 2;          /* RTP version                            */#endif  uint8_t pt;                   /* packet type                            */  uint16_t len;                 /* length of rtcp packet                  */  uint32_t ssrc;                /* SSRC/CSRC identifier                   */  char name[4];                 /* name of APP packet                     */} rtcp_app_t;/* RTCP packet */typedef struct {#ifdef WORDS_BIGENDIAN  unsigned int ver: 2;          /* RTP version                            */  unsigned int p: 1;            /* padding flag                           */  unsigned int count: 5;        /* depends of packet type                 */#else  unsigned int count: 5;        /* depends of packet type                 */  unsigned int p: 1;            /* padding flag                           */  unsigned int ver: 2;          /* RTP version                            */#endif  uint8_t pt;                   /* packet type                            */  uint16_t len;                 /* length of rtcp packet                  */  union {    uint32_t ssrc;              /* SSRC id                                */    rtcp_sr_t sr;               /* sender report                          */    rtcp_rr_t rr;               /* receiver report                        */    rtcp_sdes_t sdes;           /* source description                     */  } r;                          /* rtcp report                            */} rtcp_packet_t;/* RTP session */typedef struct {  pthread_mutex_t guard;        /* session guard                          */  uint32_t ssrc;                /* synchronization source                 */  unsigned int cc: 4;           /* CSRC count                             */  uint32_t csrc[15];            /* CSRC list                              */  uint16_t seq;                 /* sequence number                        */  uint16_t cycles;              /* sequence number cycles                 */  uint32_t pcount;              /* packet count                           */  uint32_t ocount;              /* octet count                            */  char cname[RTP_SDES_MAX];     /* canonical name                         */  char name[RTP_SDES_MAX];      /* user name                              */  char email[RTP_SDES_MAX];     /* electronic mail                        */  char phone[RTP_SDES_MAX];     /* phone number                           */  char loc[RTP_SDES_MAX];       /* user location                          */  char tool[RTP_SDES_MAX];      /* application/tool name                  */  char note[RTP_SDES_MAX];      /* notice/status                          */  ohtbl_t members;              /* table of RTP sources                   */  int flags;                    /* RTP build flags                        */} rtp_t;                        /* RTP sender session                     *//* RTP source */typedef struct {  pthread_mutex_t guard;        /* session guard                          */  uint32_t ssrc;                /* synchronization source                 */  uint16_t max_seq;             /* sequence number                        */  uint16_t cycles;              /* sequence number cycles                 */  uint32_t received;            /* total packets received                 */  unsigned int lost: 24;        /* cumulative number of packets lost      */  uint8_t frac;                 /* fraction of packets lost               */  uint32_t last_seq;            /* extended last sequence number received */  long transit;                 /* relative transit time (prev packet)    */  long jitter;                  /* estimated jitter                       */  long recv_jitter;             /* estimated reception jitter             */  uint32_t rtt;                 /* round trip time                        */  uint32_t lsr;                 /* last sender report                     */  uint32_t dlsr;                /* delay since last sender report         */  uint16_t min_seq;             /* minimal sequence number received       */  int fail_count;               /* failed packet queries                  */  phtbl_t pqueue;               /* queue of received packets              */  char cname[RTP_SDES_MAX];     /* canonical name                         */  char name[RTP_SDES_MAX];      /* user name                              */  char email[RTP_SDES_MAX];     /* electronic mail                        */  char phone[RTP_SDES_MAX];     /* phone number                           */  char loc[RTP_SDES_MAX];       /* user location                          */  char tool[RTP_SDES_MAX];      /* application/tool name                  */  char note[RTP_SDES_MAX];      /* notice/status                          */} rtp_source_t;                 /* RTP source                             *//* RTP build parameters */typedef struct {  uint8_t flags;                /* RTP flags                              */  uint16_t xdef;                /* header extension defined by profile    */  uint16_t xlen;                /* header extension lenght                */  uint32_t *xhdr;               /* header extension extra fields          */  unsigned int pt: 7;           /* payload type                           */  int len;                      /* payload lenght                         */  char *payload;                /* payload                                */} rtp_param_t;/* Initializes a RTP 'session'.                                           */void rtp_init (rtp_t *s, int flags);/* Destroy RTP session                                                    */void rtp_destroy (rtp_t *s);/* Adds CSRC to list. 'param' is the list of RTP parameters, and 'csrc'   *//* is the CSRC id of contributing source. Returns 0 on fail, 1 on         *//* success. On error, the error message will be send to 'stderr'. The     *//* CSRC entries are saved in network byte order.                          */int rtp_add_csrc (rtp_t *s, uint32_t csrc);/* Deletes CSRC from list. 'param' is the list of RTP parameters, and     *//* 'csrc' s the contributing source to be removed. Returns 0 on fail, 1   *//* on success. On error, the error message will be send to 'stderr'. The  *//* CSRC entries are saved in network byte order.                          */int rtp_del_csrc (rtp_t *s, uint32_t csrc);/* Create a new RTP packet. 'param' is the struct containing all RTP      *//* parameters, and 'session' is the RTP sender session.                   */void rtp_send (rtp_t *s, rtp_param_t *param, vstr_t *p);/* Free a received 'rtp_packet'.                                          */void rtp_packet_free (rtp_packet_t *rtp_packet);/* Parses received network 'packet' and checks for validity. Returns      *//* pointer to new parsed RTP packet.                                      */rtp_packet_t *rtp_recv (rtp_t *s, vstr_t *packet);/* Creates a RTCP Sender Report + Receiver Reports */void rtcp_send_ctrl (rtp_t *s, vstr_t *vstr);/* Appends a RTCP Source Description report */void rtcp_append_sdes (rtp_t *s, vstr_t *vstr, int flags);/* Creates a RTCP Goodbye report */vstr_t *rtcp_bye (uint32_t *ssrc_list, int list_len, char *reason, int len);/* Creates a RTCP Application-Defined report *//* packet_t *rtcp_app (void); *//* Parses received RTCP packet, checks for validity and updates RTP session */int rtcp_recv (rtp_t *s, vstr_t *packet);/* Adds RTP packet to member packet queue */int rtp_enqueue (rtp_t *s, rtp_packet_t *rtp_packet);/* Get next RTP packet from packet queue */rtp_packet_t *rtp_dequeue (rtp_t *s, uint32_t ssrc);#endif /* RTP_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -