bfcp: specify version from app for better interop

This commit is contained in:
Richard Aas 2013-03-12 14:08:47 +00:00
parent e1125a5334
commit a146cb3b91
4 changed files with 18 additions and 16 deletions

View file

@ -5,6 +5,12 @@
*/
/** BFCP Versions */
enum {
BFCP_VER1 = 1,
BFCP_VER2 = 2,
};
/** BFCP Primitives */
enum bfcp_prim {
BFCP_FLOOR_REQUEST = 1,
@ -257,13 +263,13 @@ int bfcp_listen(struct bfcp_conn **bcp, enum bfcp_transp tp, struct sa *laddr,
/* request */
int bfcp_request(struct bfcp_conn *bc, const struct sa *dst,
int bfcp_request(struct bfcp_conn *bc, const struct sa *dst, uint8_t ver,
enum bfcp_prim prim, uint32_t confid, uint16_t userid,
bfcp_resp_h *resph, void *arg, unsigned attrc, ...);
/* notify */
int bfcp_notify(struct bfcp_conn *bc, const struct sa *dst,
int bfcp_notify(struct bfcp_conn *bc, const struct sa *dst, uint8_t ver,
enum bfcp_prim prim, uint32_t confid, uint16_t userid,
unsigned attrc, ...);

View file

@ -4,12 +4,6 @@
* Copyright (C) 2010 Creytiv.com
*/
enum {
BFCP_VER1 = 1,
BFCP_VER2 = 2,
};
struct bfcp_strans {
enum bfcp_prim prim;
uint32_t confid;
@ -49,6 +43,6 @@ int bfcp_send(struct bfcp_conn *bc, const struct sa *dst, struct mbuf *mb);
/* request */
bool bfcp_handle_response(struct bfcp_conn *bc, const struct bfcp_msg *msg);
int bfcp_vrequest(struct bfcp_conn *bc, const struct sa *dst,
int bfcp_vrequest(struct bfcp_conn *bc, const struct sa *dst, uint8_t ver,
enum bfcp_prim prim, uint32_t confid, uint16_t userid,
bfcp_resp_h *resph, void *arg, unsigned attrc, va_list *ap);

View file

@ -55,7 +55,7 @@ int bfcp_reply(struct bfcp_conn *bc, const struct bfcp_msg *req,
return ENOMEM;
va_start(ap, attrc);
err = bfcp_msg_vencode(bc->mb, BFCP_VER2, true, prim, req->confid,
err = bfcp_msg_vencode(bc->mb, req->ver, true, prim, req->confid,
req->tid, req->userid, attrc, &ap);
va_end(ap);

View file

@ -140,7 +140,7 @@ bool bfcp_handle_response(struct bfcp_conn *bc, const struct bfcp_msg *msg)
}
int bfcp_vrequest(struct bfcp_conn *bc, const struct sa *dst,
int bfcp_vrequest(struct bfcp_conn *bc, const struct sa *dst, uint8_t ver,
enum bfcp_prim prim, uint32_t confid, uint16_t userid,
bfcp_resp_h *resph, void *arg, unsigned attrc, va_list *ap)
{
@ -170,7 +170,7 @@ int bfcp_vrequest(struct bfcp_conn *bc, const struct sa *dst,
goto out;
}
err = bfcp_msg_vencode(ct->mb, BFCP_VER2, false, prim, confid, ct->tid,
err = bfcp_msg_vencode(ct->mb, ver, false, prim, confid, ct->tid,
userid, attrc, ap);
if (err)
goto out;
@ -202,6 +202,7 @@ int bfcp_vrequest(struct bfcp_conn *bc, const struct sa *dst,
*
* @param bc BFCP connection
* @param dst Destination address
* @param ver BFCP Version
* @param prim BFCP Primitive
* @param confid Conference ID
* @param userid User ID
@ -211,7 +212,7 @@ int bfcp_vrequest(struct bfcp_conn *bc, const struct sa *dst,
*
* @return 0 if success, otherwise errorcode
*/
int bfcp_request(struct bfcp_conn *bc, const struct sa *dst,
int bfcp_request(struct bfcp_conn *bc, const struct sa *dst, uint8_t ver,
enum bfcp_prim prim, uint32_t confid, uint16_t userid,
bfcp_resp_h *resph, void *arg, unsigned attrc, ...)
{
@ -219,7 +220,7 @@ int bfcp_request(struct bfcp_conn *bc, const struct sa *dst,
int err;
va_start(ap, attrc);
err = bfcp_vrequest(bc, dst, prim, confid, userid, resph, arg,
err = bfcp_vrequest(bc, dst, ver, prim, confid, userid, resph, arg,
attrc, &ap);
va_end(ap);
@ -232,6 +233,7 @@ int bfcp_request(struct bfcp_conn *bc, const struct sa *dst,
*
* @param bc BFCP connection
* @param dst Destination address
* @param ver BFCP Version
* @param prim BFCP Primitive
* @param confid Conference ID
* @param userid User ID
@ -239,7 +241,7 @@ int bfcp_request(struct bfcp_conn *bc, const struct sa *dst,
*
* @return 0 if success, otherwise errorcode
*/
int bfcp_notify(struct bfcp_conn *bc, const struct sa *dst,
int bfcp_notify(struct bfcp_conn *bc, const struct sa *dst, uint8_t ver,
enum bfcp_prim prim, uint32_t confid, uint16_t userid,
unsigned attrc, ...)
{
@ -247,7 +249,7 @@ int bfcp_notify(struct bfcp_conn *bc, const struct sa *dst,
int err;
va_start(ap, attrc);
err = bfcp_vrequest(bc, dst, prim, confid, userid, NULL, NULL,
err = bfcp_vrequest(bc, dst, ver, prim, confid, userid, NULL, NULL,
attrc, &ap);
va_end(ap);