ice: use unsigned for compid
This commit is contained in:
parent
2c294d6f64
commit
dba2ee63f0
8 changed files with 39 additions and 38 deletions
|
@ -71,18 +71,18 @@ const char *ice_pwd(const struct ice *ice);
|
|||
int icem_alloc(struct icem **icemp, struct ice *ice, int proto, int layer,
|
||||
ice_gather_h *gh, ice_connchk_h *chkh, void *arg);
|
||||
void icem_set_name(struct icem *icem, const char *name);
|
||||
int icem_comp_add(struct icem *icem, uint8_t compid, void *sock);
|
||||
int icem_cand_add(struct icem *icem, uint8_t compid, uint16_t lprio,
|
||||
int icem_comp_add(struct icem *icem, unsigned compid, void *sock);
|
||||
int icem_cand_add(struct icem *icem, unsigned compid, uint16_t lprio,
|
||||
const char *ifname, const struct sa *addr);
|
||||
int icem_gather_srflx(struct icem *icem, const struct sa *stun_srv);
|
||||
int icem_gather_relay(struct icem *icem, const struct sa *stun_srv,
|
||||
const char *username, const char *password);
|
||||
int icem_lite_set_default_candidates(struct icem *icem);
|
||||
bool icem_verify_support(struct icem *icem, uint8_t compid,
|
||||
bool icem_verify_support(struct icem *icem, unsigned compid,
|
||||
const struct sa *raddr);
|
||||
int icem_conncheck_start(struct icem *icem);
|
||||
void icem_conncheck_stop(struct icem *icem, int err);
|
||||
int icem_add_chan(struct icem *icem, uint8_t compid, const struct sa *raddr);
|
||||
int icem_add_chan(struct icem *icem, unsigned compid, const struct sa *raddr);
|
||||
bool icem_mismatch(const struct icem *icem);
|
||||
void icem_update(struct icem *icem);
|
||||
int icem_sdp_decode(struct icem *icem, const char *name, const char *value);
|
||||
|
@ -91,8 +91,8 @@ struct list *icem_lcandl(const struct icem *icem);
|
|||
struct list *icem_rcandl(const struct icem *icem);
|
||||
struct list *icem_checkl(const struct icem *icem);
|
||||
struct list *icem_validl(const struct icem *icem);
|
||||
const struct sa *icem_cand_default(struct icem *icem, uint8_t compid);
|
||||
const struct sa *icem_selected_laddr(const struct icem *icem, uint8_t compid);
|
||||
const struct sa *icem_cand_default(struct icem *icem, unsigned compid);
|
||||
const struct sa *icem_selected_laddr(const struct icem *icem, unsigned compid);
|
||||
|
||||
|
||||
struct cand;
|
||||
|
@ -114,13 +114,13 @@ enum ice_cand_type ice_cand_name2type(const char *name);
|
|||
|
||||
|
||||
uint32_t ice_cand_calc_prio(enum ice_cand_type type, uint16_t local,
|
||||
uint8_t compid);
|
||||
unsigned compid);
|
||||
|
||||
|
||||
/** Defines an SDP candidate attribute */
|
||||
struct ice_cand_attr {
|
||||
char foundation[32]; /**< Foundation string */
|
||||
uint8_t compid; /**< Component ID (1-255) */
|
||||
unsigned compid; /**< Component ID (1-256) */
|
||||
int proto; /**< Transport protocol */
|
||||
uint32_t prio; /**< Priority of this candidate */
|
||||
struct sa addr; /**< Transport address */
|
||||
|
|
|
@ -49,7 +49,7 @@ static int compute_foundation(struct cand *cand)
|
|||
|
||||
|
||||
static int cand_alloc(struct cand **candp, struct icem *icem,
|
||||
enum ice_cand_type type, uint8_t compid,
|
||||
enum ice_cand_type type, unsigned compid,
|
||||
uint32_t prio, const char *ifname,
|
||||
enum ice_transp transp, const struct sa *addr)
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ static int cand_alloc(struct cand **candp, struct icem *icem,
|
|||
}
|
||||
|
||||
|
||||
int icem_lcand_add_base(struct icem *icem, uint8_t compid, uint16_t lprio,
|
||||
int icem_lcand_add_base(struct icem *icem, unsigned compid, uint16_t lprio,
|
||||
const char *ifname, enum ice_transp transp,
|
||||
const struct sa *addr)
|
||||
{
|
||||
|
@ -136,7 +136,7 @@ int icem_lcand_add(struct icem *icem, struct cand *base,
|
|||
}
|
||||
|
||||
|
||||
int icem_rcand_add(struct icem *icem, enum ice_cand_type type, uint8_t compid,
|
||||
int icem_rcand_add(struct icem *icem, enum ice_cand_type type, unsigned compid,
|
||||
uint32_t prio, const struct sa *addr,
|
||||
const struct sa *rel_addr, const struct pl *foundation)
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ int icem_rcand_add(struct icem *icem, enum ice_cand_type type, uint8_t compid,
|
|||
}
|
||||
|
||||
|
||||
int icem_rcand_add_prflx(struct cand **rcp, struct icem *icem, uint8_t compid,
|
||||
int icem_rcand_add_prflx(struct cand **rcp, struct icem *icem, unsigned compid,
|
||||
uint32_t prio, const struct sa *addr)
|
||||
{
|
||||
struct cand *rcand;
|
||||
|
@ -206,7 +206,7 @@ int icem_rcand_add_prflx(struct cand **rcp, struct icem *icem, uint8_t compid,
|
|||
}
|
||||
|
||||
|
||||
struct cand *icem_cand_find(const struct list *lst, uint8_t compid,
|
||||
struct cand *icem_cand_find(const struct list *lst, unsigned compid,
|
||||
const struct sa *addr)
|
||||
{
|
||||
struct le *le;
|
||||
|
@ -231,7 +231,8 @@ struct cand *icem_cand_find(const struct list *lst, uint8_t compid,
|
|||
/**
|
||||
* Find the highest priority LCAND on the check-list of type HOST/RELAY
|
||||
*/
|
||||
struct cand *icem_lcand_find_checklist(const struct icem *icem, uint8_t compid)
|
||||
struct cand *icem_lcand_find_checklist(const struct icem *icem,
|
||||
unsigned compid)
|
||||
{
|
||||
struct le *le;
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ void icem_candpair_set_state(struct candpair *cp, enum candpair_state state)
|
|||
* Delete all Candidate-Pairs where the Local candidate is of a given type
|
||||
*/
|
||||
void icem_candpairs_flush(struct list *lst, enum ice_cand_type type,
|
||||
uint8_t id)
|
||||
unsigned compid)
|
||||
{
|
||||
struct le *le = list_head(lst);
|
||||
|
||||
|
@ -233,7 +233,7 @@ void icem_candpairs_flush(struct list *lst, enum ice_cand_type type,
|
|||
|
||||
le = le->next;
|
||||
|
||||
if (cp->lcand->compid != id)
|
||||
if (cp->lcand->compid != compid)
|
||||
continue;
|
||||
|
||||
if (cp->lcand->type != type)
|
||||
|
@ -310,7 +310,7 @@ struct candpair *icem_candpair_find(const struct list *lst,
|
|||
}
|
||||
|
||||
|
||||
struct candpair *icem_candpair_find_st(const struct list *lst, uint8_t compid,
|
||||
struct candpair *icem_candpair_find_st(const struct list *lst, unsigned compid,
|
||||
enum candpair_state state)
|
||||
{
|
||||
struct le *le;
|
||||
|
@ -333,7 +333,7 @@ struct candpair *icem_candpair_find_st(const struct list *lst, uint8_t compid,
|
|||
|
||||
|
||||
struct candpair *icem_candpair_find_compid(const struct list *lst,
|
||||
uint8_t compid)
|
||||
unsigned compid)
|
||||
{
|
||||
struct le *le;
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ void icem_checklist_update(struct icem *icem)
|
|||
*
|
||||
* @return Local address if available, otherwise NULL
|
||||
*/
|
||||
const struct sa *icem_selected_laddr(const struct icem *icem, uint8_t compid)
|
||||
const struct sa *icem_selected_laddr(const struct icem *icem, unsigned compid)
|
||||
{
|
||||
const struct icem_comp *comp = icem_comp_find(icem, compid);
|
||||
if (!comp || !comp->cp_sel)
|
||||
|
|
|
@ -78,7 +78,7 @@ static void destructor(void *arg)
|
|||
}
|
||||
|
||||
|
||||
static struct cand *cand_default(const struct list *lcandl, uint8_t compid)
|
||||
static struct cand *cand_default(const struct list *lcandl, unsigned compid)
|
||||
{
|
||||
struct cand *def = NULL;
|
||||
struct le *le;
|
||||
|
@ -208,7 +208,7 @@ void icem_comp_set_selected(struct icem_comp *comp, struct candpair *cp)
|
|||
}
|
||||
|
||||
|
||||
struct icem_comp *icem_comp_find(const struct icem *icem, uint8_t compid)
|
||||
struct icem_comp *icem_comp_find(const struct icem *icem, unsigned compid)
|
||||
{
|
||||
struct le *le;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ struct icem_comp {
|
|||
struct udp_helper *uh; /**< UDP helper */
|
||||
void *sock; /**< Transport socket */
|
||||
uint16_t lport; /**< Local port number */
|
||||
uint8_t id; /**< Component ID */
|
||||
unsigned id; /**< Component ID */
|
||||
bool concluded; /**< Concluded flag */
|
||||
struct turnc *turnc; /**< TURN Client */
|
||||
struct stun_ctrans *ct_gath; /**< STUN Transaction for gathering */
|
||||
|
@ -108,7 +108,7 @@ struct cand {
|
|||
enum ice_cand_type type; /**< Candidate type */
|
||||
uint32_t prio; /**< Priority of this candidate */
|
||||
char *foundation; /**< Foundation */
|
||||
uint8_t compid; /**< Component ID (1-256) */
|
||||
unsigned compid; /**< Component ID (1-256) */
|
||||
struct sa rel; /**< Related IP address and port number */
|
||||
struct sa addr; /**< Transport address */
|
||||
enum ice_transp transp; /**< Transport protocol */
|
||||
|
@ -137,21 +137,21 @@ struct candpair {
|
|||
|
||||
|
||||
/* cand */
|
||||
int icem_lcand_add_base(struct icem *icem, uint8_t compid, uint16_t lprio,
|
||||
int icem_lcand_add_base(struct icem *icem, unsigned compid, uint16_t lprio,
|
||||
const char *ifname, enum ice_transp transp,
|
||||
const struct sa *addr);
|
||||
int icem_lcand_add(struct icem *icem, struct cand *base,
|
||||
enum ice_cand_type type,
|
||||
const struct sa *addr);
|
||||
int icem_rcand_add(struct icem *icem, enum ice_cand_type type, uint8_t compid,
|
||||
int icem_rcand_add(struct icem *icem, enum ice_cand_type type, unsigned compid,
|
||||
uint32_t prio, const struct sa *addr,
|
||||
const struct sa *rel_addr, const struct pl *foundation);
|
||||
int icem_rcand_add_prflx(struct cand **rcp, struct icem *icem, uint8_t compid,
|
||||
int icem_rcand_add_prflx(struct cand **rcp, struct icem *icem, unsigned compid,
|
||||
uint32_t prio, const struct sa *addr);
|
||||
struct cand *icem_cand_find(const struct list *lst, uint8_t compid,
|
||||
struct cand *icem_cand_find(const struct list *lst, unsigned compid,
|
||||
const struct sa *addr);
|
||||
struct cand *icem_lcand_find_checklist(const struct icem *icem,
|
||||
uint8_t compid);
|
||||
unsigned compid);
|
||||
int icem_cands_debug(struct re_printf *pf, const struct list *lst);
|
||||
int icem_cand_print(struct re_printf *pf, const struct cand *c);
|
||||
|
||||
|
@ -167,7 +167,7 @@ void icem_candpair_make_valid(struct candpair *cp);
|
|||
void icem_candpair_failed(struct candpair *cp, int err, uint16_t scode);
|
||||
void icem_candpair_set_state(struct candpair *cp, enum candpair_state state);
|
||||
void icem_candpairs_flush(struct list *lst, enum ice_cand_type type,
|
||||
uint8_t id);
|
||||
unsigned compid);
|
||||
bool icem_candpair_iscompleted(const struct candpair *cp);
|
||||
bool icem_candpair_cmp(const struct candpair *cp1, const struct candpair *cp2);
|
||||
bool icem_candpair_cmp_fnd(const struct candpair *cp1,
|
||||
|
@ -175,10 +175,10 @@ bool icem_candpair_cmp_fnd(const struct candpair *cp1,
|
|||
struct candpair *icem_candpair_find(const struct list *lst,
|
||||
const struct cand *lcand,
|
||||
const struct cand *rcand);
|
||||
struct candpair *icem_candpair_find_st(const struct list *lst, uint8_t compid,
|
||||
struct candpair *icem_candpair_find_st(const struct list *lst, unsigned compid,
|
||||
enum candpair_state state);
|
||||
struct candpair *icem_candpair_find_compid(const struct list *lst,
|
||||
uint8_t compid);
|
||||
unsigned compid);
|
||||
struct candpair *icem_candpair_find_rcand(struct icem *icem,
|
||||
const struct cand *rcand);
|
||||
int icem_candpair_debug(struct re_printf *pf, const struct candpair *cp);
|
||||
|
@ -206,7 +206,7 @@ int icem_comp_alloc(struct icem_comp **cp, struct icem *icem, int id,
|
|||
int icem_comp_set_default_cand(struct icem_comp *comp);
|
||||
void icem_comp_set_default_rcand(struct icem_comp *comp, struct cand *rcand);
|
||||
void icem_comp_set_selected(struct icem_comp *comp, struct candpair *cp);
|
||||
struct icem_comp *icem_comp_find(const struct icem *icem, uint8_t compid);
|
||||
struct icem_comp *icem_comp_find(const struct icem *icem, unsigned compid);
|
||||
void icem_comp_keepalive(struct icem_comp *comp, bool enable);
|
||||
void icecomp_printf(struct icem_comp *comp, const char *fmt, ...);
|
||||
int icecomp_debug(struct re_printf *pf, const struct icem_comp *comp);
|
||||
|
|
|
@ -120,7 +120,7 @@ void icem_set_name(struct icem *icem, const char *name)
|
|||
*
|
||||
* @return 0 if success, otherwise errorcode
|
||||
*/
|
||||
int icem_comp_add(struct icem *icem, uint8_t compid, void *sock)
|
||||
int icem_comp_add(struct icem *icem, unsigned compid, void *sock)
|
||||
{
|
||||
struct icem_comp *comp;
|
||||
int err;
|
||||
|
@ -152,7 +152,7 @@ int icem_comp_add(struct icem *icem, uint8_t compid, void *sock)
|
|||
*
|
||||
* @return 0 if success, otherwise errorcode
|
||||
*/
|
||||
int icem_cand_add(struct icem *icem, uint8_t compid, uint16_t lprio,
|
||||
int icem_cand_add(struct icem *icem, unsigned compid, uint16_t lprio,
|
||||
const char *ifname, const struct sa *addr)
|
||||
{
|
||||
if (!icem_comp_find(icem, compid))
|
||||
|
@ -195,7 +195,7 @@ void icem_cand_redund_elim(struct icem *icem)
|
|||
*
|
||||
* @return Default Local Candidate address if set, otherwise NULL
|
||||
*/
|
||||
const struct sa *icem_cand_default(struct icem *icem, uint8_t compid)
|
||||
const struct sa *icem_cand_default(struct icem *icem, unsigned compid)
|
||||
{
|
||||
const struct icem_comp *comp = icem_comp_find(icem, compid);
|
||||
|
||||
|
@ -215,7 +215,7 @@ const struct sa *icem_cand_default(struct icem *icem, uint8_t compid)
|
|||
*
|
||||
* @return True if ICE is supported, otherwise false
|
||||
*/
|
||||
bool icem_verify_support(struct icem *icem, uint8_t compid,
|
||||
bool icem_verify_support(struct icem *icem, unsigned compid,
|
||||
const struct sa *raddr)
|
||||
{
|
||||
struct cand *rcand;
|
||||
|
@ -248,7 +248,7 @@ bool icem_verify_support(struct icem *icem, uint8_t compid,
|
|||
*
|
||||
* @return 0 if success, otherwise errorcode
|
||||
*/
|
||||
int icem_add_chan(struct icem *icem, uint8_t compid, const struct sa *raddr)
|
||||
int icem_add_chan(struct icem *icem, unsigned compid, const struct sa *raddr)
|
||||
{
|
||||
struct icem_comp *comp;
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ static uint32_t type_prio(enum ice_cand_type type)
|
|||
|
||||
|
||||
uint32_t ice_cand_calc_prio(enum ice_cand_type type, uint16_t local,
|
||||
uint8_t compid)
|
||||
unsigned compid)
|
||||
{
|
||||
return type_prio(type)<<24 | (uint32_t)local<<8 | (256 - compid);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue