Skip to content

Commit

Permalink
ice: move gathering to application (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh authored and richaas committed Jul 15, 2017
1 parent b08fc20 commit 9263b81
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 279 deletions.
21 changes: 15 additions & 6 deletions include/re_ice.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ enum ice_candpair_state {

struct ice;
struct icem;
struct turnc;

/** ICE Configuration */
struct ice_conf {
Expand All @@ -65,16 +66,14 @@ struct ice_conf {
bool debug; /**< Enable ICE debugging */
};

typedef void (ice_gather_h)(int err, uint16_t scode, const char *reason,
void *arg);
typedef void (ice_connchk_h)(int err, bool update, void *arg);


/* ICE Media */
int icem_alloc(struct icem **icemp, enum ice_mode mode,
enum ice_role role, int proto, int layer,
uint64_t tiebrk, const char *lufrag, const char *lpwd,
ice_gather_h *gh, ice_connchk_h *chkh, void *arg);
ice_connchk_h *chkh, void *arg);
struct ice_conf *icem_conf(struct icem *icem);
enum ice_role icem_local_role(const struct icem *icem);
void icem_set_conf(struct icem *icem, const struct ice_conf *conf);
Expand All @@ -83,9 +82,7 @@ void icem_set_name(struct icem *icem, const char *name);
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, unsigned compid,
const struct sa *raddr);
Expand All @@ -104,12 +101,24 @@ struct list *icem_validl(const struct icem *icem);
const struct sa *icem_cand_default(struct icem *icem, unsigned compid);
const struct sa *icem_selected_laddr(const struct icem *icem, unsigned compid);
void ice_candpair_set_states(struct icem *icem);
void icem_cand_redund_elim(struct icem *icem);
int icem_comps_set_default_cand(struct icem *icem);
struct stun *icem_stun(struct icem *icem);
int icem_set_turn_client(struct icem *icem, unsigned compid,
struct turnc *turnc);


struct ice_cand;
bool ice_remotecands_avail(const struct icem *icem);
int ice_cand_encode(struct re_printf *pf, const struct ice_cand *cand);
int ice_remotecands_encode(struct re_printf *pf, const struct icem *icem);
struct ice_cand *icem_cand_find(const struct list *lst, unsigned compid,
const struct sa *addr);
int icem_lcand_add(struct icem *icem, struct ice_cand *base,
enum ice_cand_type type,
const struct sa *addr);
struct ice_cand *icem_lcand_base(struct ice_cand *lcand);
const struct sa *icem_lcand_addr(const struct ice_cand *cand);


extern const char ice_attr_cand[];
Expand Down
12 changes: 12 additions & 0 deletions src/ice/cand.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,18 @@ struct ice_cand *icem_lcand_find_checklist(const struct icem *icem,
}


struct ice_cand *icem_lcand_base(struct ice_cand *lcand)
{
return lcand ? lcand->base : NULL;
}


const struct sa *icem_lcand_addr(const struct ice_cand *cand)
{
return cand ? &cand->addr : NULL;
}


int icem_cands_debug(struct re_printf *pf, const struct list *lst)
{
struct le *le;
Expand Down
19 changes: 18 additions & 1 deletion src/ice/comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ static void destructor(void *arg)
struct icem_comp *comp = arg;

tmr_cancel(&comp->tmr_ka);
mem_deref(comp->ct_gath);
mem_deref(comp->turnc);
mem_deref(comp->cp_sel);
mem_deref(comp->def_lcand);
Expand Down Expand Up @@ -286,3 +285,21 @@ int icecomp_debug(struct re_printf *pf, const struct icem_comp *comp)
comp->def_rcand ? &comp->def_rcand->addr : NULL,
comp->concluded);
}


int icem_set_turn_client(struct icem *icem, unsigned compid,
struct turnc *turnc)
{
struct icem_comp *comp;

comp = icem_comp_find(icem, compid);
if (!comp)
return ENOENT;

comp->turnc = mem_deref(comp->turnc);

if (turnc)
comp->turnc = mem_ref(turnc);

return 0;
}
258 changes: 0 additions & 258 deletions src/ice/gather.c

This file was deleted.

Loading

0 comments on commit 9263b81

Please sign in to comment.