diff --git a/src/ice/cand.c b/src/ice/cand.c index b9800e4..fd53138 100644 --- a/src/ice/cand.c +++ b/src/ice/cand.c @@ -238,7 +238,7 @@ struct ice_cand *icem_lcand_find_checklist(const struct icem *icem, struct le *le; for (le = icem->checkl.head; le; le = le->next) { - struct candpair *cp = le->data; + struct ice_candpair *cp = le->data; if (cp->lcand->compid != compid) continue; diff --git a/src/ice/candpair.c b/src/ice/candpair.c index ec251d7..a2f8d00 100644 --- a/src/ice/candpair.c +++ b/src/ice/candpair.c @@ -23,7 +23,7 @@ static void candpair_destructor(void *arg) { - struct candpair *cp = arg; + struct ice_candpair *cp = arg; list_unlink(&cp->le); mem_deref(cp->ct_conn); @@ -34,14 +34,14 @@ static void candpair_destructor(void *arg) static bool sort_handler(struct le *le1, struct le *le2, void *arg) { - const struct candpair *cp1 = le1->data, *cp2 = le2->data; + const struct ice_candpair *cp1 = le1->data, *cp2 = le2->data; (void)arg; return cp1->pprio >= cp2->pprio; } -static void candpair_set_pprio(struct candpair *cp) +static void candpair_set_pprio(struct ice_candpair *cp) { uint32_t g, d; @@ -61,13 +61,13 @@ static void candpair_set_pprio(struct candpair *cp) /** * Add candidate pair to list, sorted by pair priority (highest is first) */ -static void list_add_sorted(struct list *list, struct candpair *cp) +static void list_add_sorted(struct list *list, struct ice_candpair *cp) { struct le *le; /* find our slot */ for (le = list_tail(list); le; le = le->prev) { - struct candpair *cp0 = le->data; + struct ice_candpair *cp0 = le->data; if (cp->pprio < cp0->pprio) { list_insert_after(list, le, &cp->le, cp); @@ -79,10 +79,10 @@ static void list_add_sorted(struct list *list, struct candpair *cp) } -int icem_candpair_alloc(struct candpair **cpp, struct icem *icem, +int icem_candpair_alloc(struct ice_candpair **cpp, struct icem *icem, struct ice_cand *lcand, struct ice_cand *rcand) { - struct candpair *cp; + struct ice_candpair *cp; struct icem_comp *comp; if (!icem || !lcand || !rcand) @@ -100,7 +100,7 @@ int icem_candpair_alloc(struct candpair **cpp, struct icem *icem, cp->comp = comp; cp->lcand = mem_ref(lcand); cp->rcand = mem_ref(rcand); - cp->state = CANDPAIR_FROZEN; + cp->state = ICE_CANDPAIR_FROZEN; cp->def = comp->def_lcand == lcand && comp->def_rcand == rcand; candpair_set_pprio(cp); @@ -114,10 +114,10 @@ int icem_candpair_alloc(struct candpair **cpp, struct icem *icem, } -int icem_candpair_clone(struct candpair **cpp, struct candpair *cp0, +int icem_candpair_clone(struct ice_candpair **cpp, struct ice_candpair *cp0, struct ice_cand *lcand, struct ice_cand *rcand) { - struct candpair *cp; + struct ice_candpair *cp; if (!cp0) return EINVAL; @@ -153,7 +153,7 @@ void icem_candpair_prio_order(struct list *lst) struct le *le; for (le = list_head(lst); le; le = le->next) { - struct candpair *cp = le->data; + struct ice_candpair *cp = le->data; candpair_set_pprio(cp); } @@ -163,7 +163,7 @@ void icem_candpair_prio_order(struct list *lst) /* cancel transaction */ -void icem_candpair_cancel(struct candpair *cp) +void icem_candpair_cancel(struct ice_candpair *cp) { if (!cp) return; @@ -172,7 +172,7 @@ void icem_candpair_cancel(struct candpair *cp) } -void icem_candpair_make_valid(struct candpair *cp) +void icem_candpair_make_valid(struct ice_candpair *cp) { if (!cp) return; @@ -181,14 +181,14 @@ void icem_candpair_make_valid(struct candpair *cp) cp->scode = 0; cp->valid = true; - icem_candpair_set_state(cp, CANDPAIR_SUCCEEDED); + icem_candpair_set_state(cp, ICE_CANDPAIR_SUCCEEDED); list_unlink(&cp->le); list_add_sorted(&cp->icem->validl, cp); } -void icem_candpair_failed(struct candpair *cp, int err, uint16_t scode) +void icem_candpair_failed(struct ice_candpair *cp, int err, uint16_t scode) { if (!cp) return; @@ -197,11 +197,12 @@ void icem_candpair_failed(struct candpair *cp, int err, uint16_t scode) cp->scode = scode; cp->valid = false; - icem_candpair_set_state(cp, CANDPAIR_FAILED); + icem_candpair_set_state(cp, ICE_CANDPAIR_FAILED); } -void icem_candpair_set_state(struct candpair *cp, enum candpair_state state) +void icem_candpair_set_state(struct ice_candpair *cp, + enum ice_candpair_state state) { if (!cp) return; @@ -229,7 +230,7 @@ void icem_candpairs_flush(struct list *lst, enum ice_cand_type type, while (le) { - struct candpair *cp = le->data; + struct ice_candpair *cp = le->data; le = le->next; @@ -244,12 +245,13 @@ void icem_candpairs_flush(struct list *lst, enum ice_cand_type type, } -bool icem_candpair_iscompleted(const struct candpair *cp) +bool icem_candpair_iscompleted(const struct ice_candpair *cp) { if (!cp) return false; - return cp->state == CANDPAIR_FAILED || cp->state == CANDPAIR_SUCCEEDED; + return cp->state == ICE_CANDPAIR_FAILED || + cp->state == ICE_CANDPAIR_SUCCEEDED; } @@ -261,7 +263,8 @@ bool icem_candpair_iscompleted(const struct candpair *cp) * * @return true if match */ -bool icem_candpair_cmp(const struct candpair *cp1, const struct candpair *cp2) +bool icem_candpair_cmp(const struct ice_candpair *cp1, + const struct ice_candpair *cp2) { if (!sa_cmp(&cp1->lcand->addr, &cp2->lcand->addr, SA_ALL)) return false; @@ -282,7 +285,7 @@ bool icem_candpair_cmp(const struct candpair *cp1, const struct candpair *cp2) * * note: assume list is sorted by priority */ -struct candpair *icem_candpair_find(const struct list *lst, +struct ice_candpair *icem_candpair_find(const struct list *lst, const struct ice_cand *lcand, const struct ice_cand *rcand) { @@ -290,7 +293,7 @@ struct candpair *icem_candpair_find(const struct list *lst, for (le = list_head(lst); le; le = le->next) { - struct candpair *cp = le->data; + struct ice_candpair *cp = le->data; if (!cp->lcand || !cp->rcand) { DEBUG_WARNING("corrupt candpair %p\n", cp); @@ -310,14 +313,15 @@ struct candpair *icem_candpair_find(const struct list *lst, } -struct candpair *icem_candpair_find_st(const struct list *lst, unsigned compid, - enum candpair_state state) +struct ice_candpair *icem_candpair_find_st(const struct list *lst, + unsigned compid, + enum ice_candpair_state state) { struct le *le; for (le = list_head(lst); le; le = le->next) { - struct candpair *cp = le->data; + struct ice_candpair *cp = le->data; if (compid && cp->lcand->compid != compid) continue; @@ -332,14 +336,14 @@ struct candpair *icem_candpair_find_st(const struct list *lst, unsigned compid, } -struct candpair *icem_candpair_find_compid(const struct list *lst, +struct ice_candpair *icem_candpair_find_compid(const struct list *lst, unsigned compid) { struct le *le; for (le = list_head(lst); le; le = le->next) { - struct candpair *cp = le->data; + struct ice_candpair *cp = le->data; if (cp->lcand->compid != compid) continue; @@ -354,10 +358,10 @@ struct candpair *icem_candpair_find_compid(const struct list *lst, /** * Find a remote candidate in the checklist or validlist */ -struct candpair *icem_candpair_find_rcand(struct icem *icem, +struct ice_candpair *icem_candpair_find_rcand(struct icem *icem, const struct ice_cand *rcand) { - struct candpair *cp; + struct ice_candpair *cp; cp = icem_candpair_find(&icem->checkl, NULL, rcand); if (cp) @@ -371,8 +375,8 @@ struct candpair *icem_candpair_find_rcand(struct icem *icem, } -bool icem_candpair_cmp_fnd(const struct candpair *cp1, - const struct candpair *cp2) +bool icem_candpair_cmp_fnd(const struct ice_candpair *cp1, + const struct ice_candpair *cp2) { if (!cp1 || !cp2) return false; @@ -382,7 +386,7 @@ bool icem_candpair_cmp_fnd(const struct candpair *cp1, } -int icem_candpair_debug(struct re_printf *pf, const struct candpair *cp) +int icem_candpair_debug(struct re_printf *pf, const struct ice_candpair *cp) { int err; @@ -420,7 +424,7 @@ int icem_candpairs_debug(struct re_printf *pf, const struct list *list) for (le = list->head; le && !err; le = le->next) { - const struct candpair *cp = le->data; + const struct ice_candpair *cp = le->data; bool is_selected = (cp == cp->comp->cp_sel); err = re_hprintf(pf, " %c %H\n", diff --git a/src/ice/chklist.c b/src/ice/chklist.c index 5c9235b..6a3b6fa 100644 --- a/src/ice/chklist.c +++ b/src/ice/chklist.c @@ -72,7 +72,7 @@ static const struct sa *cand_srflx_addr(const struct ice_cand *c) /* return: NULL to keep, pointer to remove object */ static void *unique_handler(struct le *le1, struct le *le2) { - struct candpair *cp1 = le1->data, *cp2 = le2->data; + struct ice_candpair *cp1 = le1->data, *cp2 = le2->data; if (cp1->comp->id != cp2->comp->id) return NULL; @@ -123,11 +123,11 @@ static void candpair_set_states(struct icem *icem) for (le = icem->checkl.head; le; le = le->next) { - struct candpair *cp = le->data; + struct ice_candpair *cp = le->data; for (le2 = icem->checkl.head; le2; le2 = le2->next) { - struct candpair *cp2 = le2->data; + struct ice_candpair *cp2 = le2->data; if (!icem_candpair_cmp_fnd(cp, cp2)) continue; @@ -137,7 +137,7 @@ static void candpair_set_states(struct icem *icem) cp = cp2; } - icem_candpair_set_state(cp, CANDPAIR_WAITING); + icem_candpair_set_state(cp, ICE_CANDPAIR_WAITING); } } @@ -199,7 +199,7 @@ static bool iscompleted(const struct icem *icem) for (le = icem->checkl.head; le; le = le->next) { - const struct candpair *cp = le->data; + const struct ice_candpair *cp = le->data; if (!icem_candpair_iscompleted(cp)) return false; @@ -212,14 +212,14 @@ static bool iscompleted(const struct icem *icem) /* 8. Concluding ICE Processing */ static void concluding_ice(struct icem_comp *comp) { - struct candpair *cp; + struct ice_candpair *cp; if (!comp || comp->concluded) return; /* pick the best candidate pair, highest priority */ cp = icem_candpair_find_st(&comp->icem->validl, comp->id, - CANDPAIR_SUCCEEDED); + ICE_CANDPAIR_SUCCEEDED); if (!cp) { DEBUG_WARNING("{%s.%u} conclude: no valid candpair found" " (validlist=%u)\n", @@ -279,7 +279,7 @@ void icem_checklist_update(struct icem *icem) icem_comp_keepalive(comp, true); } - icem->state = err ? CHECKLIST_FAILED : CHECKLIST_COMPLETED; + icem->state = err ? ICE_CHECKLIST_FAILED : ICE_CHECKLIST_COMPLETED; if (icem->chkh) { icem->chkh(err, icem->ice->lrole == ROLE_CONTROLLING, diff --git a/src/ice/comp.c b/src/ice/comp.c index d32bdac..4454dd9 100644 --- a/src/ice/comp.c +++ b/src/ice/comp.c @@ -194,12 +194,12 @@ void icem_comp_set_default_rcand(struct icem_comp *comp, } -void icem_comp_set_selected(struct icem_comp *comp, struct candpair *cp) +void icem_comp_set_selected(struct icem_comp *comp, struct ice_candpair *cp) { if (!comp || !cp) return; - if (cp->state != CANDPAIR_SUCCEEDED) { + if (cp->state != ICE_CANDPAIR_SUCCEEDED) { DEBUG_WARNING("{%s.%u} set_selected: invalid state %s\n", comp->icem->name, comp->id, ice_candpair_state2name(cp->state)); @@ -232,7 +232,7 @@ struct icem_comp *icem_comp_find(const struct icem *icem, unsigned compid) static void timeout(void *arg) { struct icem_comp *comp = arg; - struct candpair *cp; + struct ice_candpair *cp; tmr_start(&comp->tmr_ka, ICE_DEFAULT_Tr * 1000 + rand_u16() % 1000, timeout, comp); diff --git a/src/ice/connchk.c b/src/ice/connchk.c index fd466fb..aaec2dd 100644 --- a/src/ice/connchk.c +++ b/src/ice/connchk.c @@ -23,12 +23,12 @@ static void pace_next(struct icem *icem) { - if (icem->state != CHECKLIST_RUNNING) + if (icem->state != ICE_CHECKLIST_RUNNING) return; icem_conncheck_schedule_check(icem); - if (icem->state == CHECKLIST_FAILED) + if (icem->state == ICE_CHECKLIST_FAILED) return; icem_checklist_update(icem); @@ -40,13 +40,13 @@ static void pace_next(struct icem *icem) * * @return The valid pair */ -static struct candpair *construct_valid_pair(struct icem *icem, - struct candpair *cp, +static struct ice_candpair *construct_valid_pair(struct icem *icem, + struct ice_candpair *cp, const struct sa *mapped, const struct sa *dest) { struct ice_cand *lcand, *rcand; - struct candpair *cp2; + struct ice_candpair *cp2; int err; lcand = icem_cand_find(&icem->lcandl, cp->lcand->compid, mapped); @@ -105,7 +105,7 @@ static struct candpair *construct_valid_pair(struct icem *icem, } -static void handle_success(struct icem *icem, struct candpair *cp, +static void handle_success(struct icem *icem, struct ice_candpair *cp, const struct sa *laddr) { if (!icem_cand_find(&icem->lcandl, cp->lcand->compid, laddr)) { @@ -155,7 +155,7 @@ static int print_err(struct re_printf *pf, const int *err) static void stunc_resp_handler(int err, uint16_t scode, const char *reason, const struct stun_msg *msg, void *arg) { - struct candpair *cp = arg; + struct ice_candpair *cp = arg; struct icem *icem = cp->icem; struct stun_attr *attr; @@ -203,7 +203,7 @@ static void stunc_resp_handler(int err, uint16_t scode, const char *reason, } -int icem_conncheck_send(struct candpair *cp, bool use_cand, bool trigged) +int icem_conncheck_send(struct ice_candpair *cp, bool use_cand, bool trigged) { struct ice_cand *lcand = cp->lcand; struct icem *icem = cp->icem; @@ -214,7 +214,7 @@ int icem_conncheck_send(struct candpair *cp, bool use_cand, bool trigged) uint16_t ctrl_attr; int err = 0; - icem_candpair_set_state(cp, CANDPAIR_INPROGRESS); + icem_candpair_set_state(cp, ICE_CANDPAIR_INPROGRESS); (void)re_snprintf(username_buf, sizeof(username_buf), "%s:%s", icem->rufrag, ice->lufrag); @@ -304,7 +304,7 @@ int icem_conncheck_send(struct candpair *cp, bool use_cand, bool trigged) static void abort_ice(struct icem *icem, int err) { - icem->state = CHECKLIST_FAILED; + icem->state = ICE_CHECKLIST_FAILED; tmr_cancel(&icem->tmr_pace); if (icem->chkh) { @@ -316,7 +316,7 @@ static void abort_ice(struct icem *icem, int err) } -static void do_check(struct candpair *cp) +static void do_check(struct ice_candpair *cp) { int err; @@ -339,11 +339,11 @@ static void do_check(struct candpair *cp) */ void icem_conncheck_schedule_check(struct icem *icem) { - struct candpair *cp; + struct ice_candpair *cp; /* Find the highest priority pair in that check list that is in the Waiting state. */ - cp = icem_candpair_find_st(&icem->checkl, 0, CANDPAIR_WAITING); + cp = icem_candpair_find_st(&icem->checkl, 0, ICE_CANDPAIR_WAITING); if (cp) { do_check(cp); return; @@ -353,7 +353,7 @@ void icem_conncheck_schedule_check(struct icem *icem) /* Find the highest priority pair in that check list that is in the Frozen state. */ - cp = icem_candpair_find_st(&icem->checkl, 0, CANDPAIR_FROZEN); + cp = icem_candpair_find_st(&icem->checkl, 0, ICE_CANDPAIR_FROZEN); if (cp) { /* If there is such a pair: */ /* Unfreeze the pair. @@ -368,7 +368,7 @@ void icem_conncheck_schedule_check(struct icem *icem) /* Terminate the timer for that check list. */ #if 0 - icem->state = CHECKLIST_COMPLETED; + icem->state = ICE_CHECKLIST_COMPLETED; #endif } @@ -398,7 +398,7 @@ int icem_conncheck_start(struct icem *icem) if (err) return err; - icem->state = CHECKLIST_RUNNING; + icem->state = ICE_CHECKLIST_RUNNING; icem_printf(icem, "starting connectivity checks" " with %u candidate pairs\n", @@ -425,12 +425,12 @@ void icem_conncheck_stop(struct icem *icem, int err) { struct le *le; - icem->state = err ? CHECKLIST_FAILED : CHECKLIST_COMPLETED; + icem->state = err ? ICE_CHECKLIST_FAILED : ICE_CHECKLIST_COMPLETED; tmr_cancel(&icem->tmr_pace); for (le = icem->checkl.head; le; le = le->next) { - struct candpair *cp = le->data; + struct ice_candpair *cp = le->data; if (!icem_candpair_iscompleted(cp)) { icem_candpair_cancel(cp); diff --git a/src/ice/ice.h b/src/ice/ice.h index 3037de9..19f0ae5 100644 --- a/src/ice/ice.h +++ b/src/ice/ice.h @@ -16,20 +16,20 @@ enum role { ROLE_CONTROLLED }; -enum checkl_state { - CHECKLIST_NULL = -1, - CHECKLIST_RUNNING, - CHECKLIST_COMPLETED, - CHECKLIST_FAILED +enum ice_checkl_state { + ICE_CHECKLIST_NULL = -1, + ICE_CHECKLIST_RUNNING, + ICE_CHECKLIST_COMPLETED, + ICE_CHECKLIST_FAILED }; /** Candidate pair states */ -enum candpair_state { - CANDPAIR_FROZEN = 0, /**< Frozen state (default) */ - CANDPAIR_WAITING, /**< Waiting to become highest on list */ - CANDPAIR_INPROGRESS, /**< In-Progress state;transaction in progress */ - CANDPAIR_SUCCEEDED, /**< Succeeded state; successful check result */ - CANDPAIR_FAILED /**< Failed state; check failed */ +enum ice_candpair_state { + ICE_CANDPAIR_FROZEN = 0, /**< Frozen state (default) */ + ICE_CANDPAIR_WAITING, /**< Waiting to become highest on list */ + ICE_CANDPAIR_INPROGRESS, /**< In-Progress state;transac. in progress */ + ICE_CANDPAIR_SUCCEEDED, /**< Succeeded state; successful result */ + ICE_CANDPAIR_FAILED /**< Failed state; check failed */ }; enum ice_transp { @@ -67,7 +67,7 @@ struct icem_comp { struct icem *icem; /**< Parent ICE media */ struct ice_cand *def_lcand; /**< Default local candidate */ struct ice_cand *def_rcand; /**< Default remote candidate */ - struct candpair *cp_sel; /**< Selected candidate-pair */ + struct ice_candpair *cp_sel; /**< Selected candidate-pair */ struct udp_helper *uh; /**< UDP helper */ void *sock; /**< Transport socket */ uint16_t lport; /**< Local port number */ @@ -92,7 +92,7 @@ struct icem { struct tmr tmr_pace; /**< Timer for pacing STUN requests */ int proto; /**< Transport protocol */ int layer; /**< Protocol layer */ - enum checkl_state state; /**< State of the checklist */ + enum ice_checkl_state state; /**< State of the checklist */ struct list compl; /**< ICE media components */ char *rufrag; /**< Remote Username fragment */ char *rpwd; /**< Remote Password */ @@ -119,7 +119,7 @@ struct ice_cand { }; /** Defines a candidate pair */ -struct candpair { +struct ice_candpair { struct le le; /**< List element */ struct icem *icem; /**< Pointer to parent ICE media */ struct icem_comp *comp; /**< Pointer to media-stream component */ @@ -128,7 +128,7 @@ struct candpair { bool def; /**< Default flag */ bool valid; /**< Valid flag */ bool nominated; /**< Nominated flag */ - enum candpair_state state; /**< Candidate pair state */ + enum ice_candpair_state state;/**< Candidate pair state */ uint64_t pprio; /**< Pair priority */ struct stun_ctrans *ct_conn; /**< STUN Transaction for conncheck */ int err; /**< Saved error code, if failed */ @@ -158,31 +158,34 @@ int icem_cand_print(struct re_printf *pf, const struct ice_cand *cand); /* candpair */ -int icem_candpair_alloc(struct candpair **cpp, struct icem *icem, +int icem_candpair_alloc(struct ice_candpair **cpp, struct icem *icem, struct ice_cand *lcand, struct ice_cand *rcand); -int icem_candpair_clone(struct candpair **cpp, struct candpair *cp0, +int icem_candpair_clone(struct ice_candpair **cpp, struct ice_candpair *cp0, struct ice_cand *lcand, struct ice_cand *rcand); void icem_candpair_prio_order(struct list *lst); -void icem_candpair_cancel(struct candpair *cp); -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_candpair_cancel(struct ice_candpair *cp); +void icem_candpair_make_valid(struct ice_candpair *cp); +void icem_candpair_failed(struct ice_candpair *cp, int err, uint16_t scode); +void icem_candpair_set_state(struct ice_candpair *cp, + enum ice_candpair_state state); void icem_candpairs_flush(struct list *lst, enum ice_cand_type type, 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, - const struct candpair *cp2); -struct candpair *icem_candpair_find(const struct list *lst, +bool icem_candpair_iscompleted(const struct ice_candpair *cp); +bool icem_candpair_cmp(const struct ice_candpair *cp1, + const struct ice_candpair *cp2); +bool icem_candpair_cmp_fnd(const struct ice_candpair *cp1, + const struct ice_candpair *cp2); +struct ice_candpair *icem_candpair_find(const struct list *lst, const struct ice_cand *lcand, const struct ice_cand *rcand); -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, +struct ice_candpair *icem_candpair_find_st(const struct list *lst, + unsigned compid, + enum ice_candpair_state state); +struct ice_candpair *icem_candpair_find_compid(const struct list *lst, unsigned compid); -struct candpair *icem_candpair_find_rcand(struct icem *icem, +struct ice_candpair *icem_candpair_find_rcand(struct icem *icem, const struct ice_cand *rcand); -int icem_candpair_debug(struct re_printf *pf, const struct candpair *cp); +int icem_candpair_debug(struct re_printf *pf, const struct ice_candpair *cp); int icem_candpairs_debug(struct re_printf *pf, const struct list *list); @@ -207,7 +210,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 ice_cand *rcand); -void icem_comp_set_selected(struct icem_comp *comp, struct candpair *cp); +void icem_comp_set_selected(struct icem_comp *comp, struct ice_candpair *cp); 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, ...); @@ -217,14 +220,14 @@ int icecomp_debug(struct re_printf *pf, const struct icem_comp *comp); /* conncheck */ void icem_conncheck_schedule_check(struct icem *icem); void icem_conncheck_continue(struct icem *icem); -int icem_conncheck_send(struct candpair *cp, bool use_cand, bool trigged); +int icem_conncheck_send(struct ice_candpair *cp, bool use_cand, bool trigged); /* icestr */ const char *ice_mode2name(enum ice_mode mode); const char *ice_role2name(enum role role); -const char *ice_candpair_state2name(enum candpair_state st); -const char *ice_checkl_state2name(enum checkl_state cst); +const char *ice_candpair_state2name(enum ice_candpair_state st); +const char *ice_checkl_state2name(enum ice_checkl_state cst); /* util */ diff --git a/src/ice/icem.c b/src/ice/icem.c index 0490455..ee51294 100644 --- a/src/ice/icem.c +++ b/src/ice/icem.c @@ -75,7 +75,7 @@ int icem_alloc(struct icem **icemp, struct ice *ice, int proto, int layer, icem->ice = ice; icem->layer = layer; icem->proto = proto; - icem->state = CHECKLIST_NULL; + icem->state = ICE_CHECKLIST_NULL; icem->nstun = 0; icem->gh = gh; icem->chkh = chkh; @@ -397,7 +397,7 @@ struct list *icem_rcandl(const struct icem *icem) * * @param icem ICE Media object * - * @return Checklist (struct candpair) + * @return Checklist (struct ice_candpair) */ struct list *icem_checkl(const struct icem *icem) { @@ -410,7 +410,7 @@ struct list *icem_checkl(const struct icem *icem) * * @param icem ICE Media object * - * @return Validlist (struct candpair) + * @return Validlist (struct ice_candpair) */ struct list *icem_validl(const struct icem *icem) { diff --git a/src/ice/icesdp.c b/src/ice/icesdp.c index e2412c2..2ed6f55 100644 --- a/src/ice/icesdp.c +++ b/src/ice/icesdp.c @@ -97,7 +97,7 @@ bool ice_remotecands_avail(const struct icem *icem) return false; return icem->ice->lrole == ROLE_CONTROLLING && - icem->state == CHECKLIST_COMPLETED; + icem->state == ICE_CHECKLIST_COMPLETED; } diff --git a/src/ice/icestr.c b/src/ice/icestr.c index f284381..0d92fa0 100644 --- a/src/ice/icestr.c +++ b/src/ice/icestr.c @@ -61,28 +61,28 @@ const char *ice_role2name(enum role role) } -const char *ice_candpair_state2name(enum candpair_state st) +const char *ice_candpair_state2name(enum ice_candpair_state st) { switch (st) { - case CANDPAIR_FROZEN: return "Frozen"; - case CANDPAIR_WAITING: return "Waiting"; - case CANDPAIR_INPROGRESS: return "InProgress"; - case CANDPAIR_SUCCEEDED: return "Succeeded"; - case CANDPAIR_FAILED: return "Failed"; - default: return "???"; + case ICE_CANDPAIR_FROZEN: return "Frozen"; + case ICE_CANDPAIR_WAITING: return "Waiting"; + case ICE_CANDPAIR_INPROGRESS: return "InProgress"; + case ICE_CANDPAIR_SUCCEEDED: return "Succeeded"; + case ICE_CANDPAIR_FAILED: return "Failed"; + default: return "???"; } } -const char *ice_checkl_state2name(enum checkl_state cst) +const char *ice_checkl_state2name(enum ice_checkl_state cst) { switch (cst) { - case CHECKLIST_NULL: return "(NULL)"; - case CHECKLIST_RUNNING: return "Running"; - case CHECKLIST_COMPLETED: return "Completed"; - case CHECKLIST_FAILED: return "Failed"; - default: return "???"; + case ICE_CHECKLIST_NULL: return "(NULL)"; + case ICE_CHECKLIST_RUNNING: return "Running"; + case ICE_CHECKLIST_COMPLETED: return "Completed"; + case ICE_CHECKLIST_FAILED: return "Failed"; + default: return "???"; } } diff --git a/src/ice/stunsrv.c b/src/ice/stunsrv.c index 6862d91..c405fc0 100644 --- a/src/ice/stunsrv.c +++ b/src/ice/stunsrv.c @@ -28,7 +28,7 @@ static const char *sw = "ice stunsrv v" VERSION " (" ARCH "/" OS ")"; static void triggered_check(struct icem *icem, struct ice_cand *lcand, struct ice_cand *rcand) { - struct candpair *cp = NULL; + struct ice_candpair *cp = NULL; int err; if (lcand && rcand) @@ -45,24 +45,24 @@ static void triggered_check(struct icem *icem, struct ice_cand *lcand, * both agents are stuck on sending * triggered checks on the same candidate pair */ - case CANDPAIR_INPROGRESS: + case ICE_CANDPAIR_INPROGRESS: icem_candpair_cancel(cp); /*@fallthrough@*/ #endif - case CANDPAIR_FAILED: - icem_candpair_set_state(cp, CANDPAIR_WAITING); + case ICE_CANDPAIR_FAILED: + icem_candpair_set_state(cp, ICE_CANDPAIR_WAITING); /*@fallthrough@*/ - case CANDPAIR_FROZEN: - case CANDPAIR_WAITING: + case ICE_CANDPAIR_FROZEN: + case ICE_CANDPAIR_WAITING: err = icem_conncheck_send(cp, false, true); if (err) { DEBUG_WARNING("triggered check failed\n"); } break; - case CANDPAIR_SUCCEEDED: + case ICE_CANDPAIR_SUCCEEDED: default: break; } @@ -80,7 +80,7 @@ static void triggered_check(struct icem *icem, struct ice_cand *lcand, icem_candpair_prio_order(&icem->checkl); - icem_candpair_set_state(cp, CANDPAIR_WAITING); + icem_candpair_set_state(cp, ICE_CANDPAIR_WAITING); (void)icem_conncheck_send(cp, false, true); #endif @@ -97,7 +97,7 @@ static int handle_stun_full(struct ice *ice, struct icem *icem, uint32_t prio, bool use_cand, bool tunnel) { struct ice_cand *lcand = NULL, *rcand; - struct candpair *cp = NULL; + struct ice_candpair *cp = NULL; int err; rcand = icem_cand_find(&icem->rcandl, comp->id, src); @@ -146,7 +146,7 @@ static int handle_stun_full(struct ice *ice, struct icem *icem, /* 7.2.1.5. Updating the Nominated Flag */ if (use_cand) { if (ice->lrole == ROLE_CONTROLLED && - cp->state == CANDPAIR_SUCCEEDED) { + cp->state == ICE_CANDPAIR_SUCCEEDED) { if (!cp->nominated) { icecomp_printf(comp, "setting NOMINATED" @@ -178,7 +178,7 @@ static int handle_stun_lite(struct icem *icem, bool use_cand) { struct ice_cand *lcand, *rcand; - struct candpair *cp; + struct ice_candpair *cp; int err; if (!use_cand)