summaryrefslogtreecommitdiff
path: root/accel-pppd/extra/shaper_tbf.c
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2012-06-19 19:06:06 +0400
committerKozlov Dmitry <xeb@mail.ru>2012-06-19 19:06:06 +0400
commit02b3fb2b24aacd90d535c2136a055f529d722974 (patch)
tree6243dd815869add07be2bad5846e7817b732ac59 /accel-pppd/extra/shaper_tbf.c
parentc553a7bbbc96d36ba4d0999bb172c7a926518eb1 (diff)
downloadaccel-ppp-02b3fb2b24aacd90d535c2136a055f529d722974.tar.gz
accel-ppp-02b3fb2b24aacd90d535c2136a055f529d722974.zip
general preparation for IPoE integration
Diffstat (limited to 'accel-pppd/extra/shaper_tbf.c')
-rw-r--r--accel-pppd/extra/shaper_tbf.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/accel-pppd/extra/shaper_tbf.c b/accel-pppd/extra/shaper_tbf.c
index 718a5c58..7c16475d 100644
--- a/accel-pppd/extra/shaper_tbf.c
+++ b/accel-pppd/extra/shaper_tbf.c
@@ -58,7 +58,7 @@ struct shaper_pd_t
{
struct list_head entry;
struct ppp_t *ppp;
- struct ppp_pd_t pd;
+ struct ap_private pd;
int temp_down_speed;
int temp_up_speed;
int down_speed;
@@ -427,7 +427,7 @@ out:
static struct shaper_pd_t *find_pd(struct ppp_t *ppp, int create)
{
- struct ppp_pd_t *pd;
+ struct ap_private *pd;
struct shaper_pd_t *spd;
list_for_each_entry(pd, &ppp->pd_list, entry) {
@@ -732,7 +732,7 @@ static void ev_radius_access_accept(struct ev_radius_t *ev)
}
if (down_speed > 0 && up_speed > 0) {
- if (!install_shaper(ev->ppp->ifname, down_speed, down_burst, up_speed, up_burst)) {
+ if (!install_shaper(ev->ppp->ses.ifname, down_speed, down_burst, up_speed, up_burst)) {
if (conf_verbose)
log_ppp_info2("tbf: installed shaper %i/%i (Kbit)\n", down_speed, up_speed);
}
@@ -760,7 +760,7 @@ static void ev_radius_coa(struct ev_radius_t *ev)
pd->up_speed = 0;
if (conf_verbose)
log_ppp_info2("tbf: removed shaper\n");
- remove_shaper(ev->ppp->ifname);
+ remove_shaper(ev->ppp->ses.ifname);
}
return;
}
@@ -769,13 +769,13 @@ static void ev_radius_coa(struct ev_radius_t *ev)
pd->down_speed = pd->cur_tr->down_speed;
pd->up_speed = pd->cur_tr->up_speed;
- if (remove_shaper(ev->ppp->ifname)) {
+ if (remove_shaper(ev->ppp->ses.ifname)) {
ev->res = -1;
return;
}
if (pd->down_speed > 0 || pd->up_speed > 0) {
- if (install_shaper(ev->ppp->ifname, pd->cur_tr->down_speed, pd->cur_tr->down_burst, pd->cur_tr->up_speed, pd->cur_tr->up_burst)) {
+ if (install_shaper(ev->ppp->ses.ifname, pd->cur_tr->down_speed, pd->cur_tr->down_burst, pd->cur_tr->up_speed, pd->cur_tr->up_burst)) {
ev->res= -1;
return;
} else {
@@ -827,7 +827,7 @@ static void ev_shaper(struct ev_shaper_t *ev)
}
if (pd->down_speed > 0 && pd->up_speed > 0) {
- if (!install_shaper(ev->ppp->ifname, down_speed, down_burst, up_speed, up_burst)) {
+ if (!install_shaper(ev->ppp->ses.ifname, down_speed, down_burst, up_speed, up_burst)) {
if (conf_verbose)
log_ppp_info2("tbf: installed shaper %i/%i (Kbit)\n", down_speed, up_speed);
}
@@ -845,7 +845,7 @@ static void ev_ppp_pre_up(struct ppp_t *ppp)
pd->temp_up_speed = temp_up_speed;
pd->down_speed = temp_down_speed;
pd->up_speed = temp_up_speed;
- if (!install_shaper(ppp->ifname, temp_down_speed, 0, temp_up_speed, 0)) {
+ if (!install_shaper(ppp->ses.ifname, temp_down_speed, 0, temp_up_speed, 0)) {
if (conf_verbose)
log_ppp_info2("tbf: installed shaper %i/%i (Kbit)\n", temp_down_speed, temp_up_speed);
}
@@ -875,16 +875,16 @@ static void shaper_change_help(char * const *f, int f_cnt, void *cli)
static void shaper_change(struct shaper_pd_t *pd)
{
if (pd->down_speed || pd->up_speed)
- remove_shaper(pd->ppp->ifname);
+ remove_shaper(pd->ppp->ses.ifname);
if (pd->temp_down_speed || pd->temp_up_speed) {
pd->down_speed = pd->temp_down_speed;
pd->up_speed = pd->temp_up_speed;
- install_shaper(pd->ppp->ifname, pd->temp_down_speed, 0, pd->temp_up_speed, 0);
+ install_shaper(pd->ppp->ses.ifname, pd->temp_down_speed, 0, pd->temp_up_speed, 0);
} else if (pd->cur_tr->down_speed || pd->cur_tr->up_speed) {
pd->down_speed = pd->cur_tr->down_speed;
pd->up_speed = pd->cur_tr->up_speed;
- install_shaper(pd->ppp->ifname, pd->cur_tr->down_speed, pd->cur_tr->down_burst, pd->cur_tr->up_speed, pd->cur_tr->up_burst);
+ install_shaper(pd->ppp->ses.ifname, pd->cur_tr->down_speed, pd->cur_tr->down_burst, pd->cur_tr->up_speed, pd->cur_tr->up_burst);
}
}
@@ -921,7 +921,7 @@ static int shaper_change_exec(const char *cmd, char * const *f, int f_cnt, void
pthread_rwlock_rdlock(&shaper_lock);
list_for_each_entry(pd, &shaper_list, entry) {
- if (all || !strcmp(f[2], pd->ppp->ifname)) {
+ if (all || !strcmp(f[2], pd->ppp->ses.ifname)) {
if (temp) {
pd->temp_down_speed = down_speed;
pd->temp_up_speed = up_speed;
@@ -935,7 +935,7 @@ static int shaper_change_exec(const char *cmd, char * const *f, int f_cnt, void
pd->cur_tr->up_speed = up_speed;
pd->cur_tr->up_burst = up_burst;
}
- triton_context_call(pd->ppp->ctrl->ctx, (triton_event_func)shaper_change, pd);
+ triton_context_call(pd->ppp->ses.ctrl->ctx, (triton_event_func)shaper_change, pd);
if (!all) {
found = 1;
break;
@@ -958,12 +958,12 @@ static void shaper_restore_help(char * const *f, int f_cnt, void *cli)
static void shaper_restore(struct shaper_pd_t *pd)
{
- remove_shaper(pd->ppp->ifname);
+ remove_shaper(pd->ppp->ses.ifname);
if (pd->cur_tr) {
pd->down_speed = pd->cur_tr->down_speed;
pd->up_speed = pd->cur_tr->up_speed;
- install_shaper(pd->ppp->ifname, pd->cur_tr->down_speed, pd->cur_tr->down_burst, pd->cur_tr->up_speed, pd->cur_tr->up_burst);
+ install_shaper(pd->ppp->ses.ifname, pd->cur_tr->down_speed, pd->cur_tr->down_burst, pd->cur_tr->up_speed, pd->cur_tr->up_burst);
} else {
pd->down_speed = 0;
pd->up_speed = 0;
@@ -991,10 +991,10 @@ static int shaper_restore_exec(const char *cmd, char * const *f, int f_cnt, void
list_for_each_entry(pd, &shaper_list, entry) {
if (!pd->temp_down_speed)
continue;
- if (all || !strcmp(f[2], pd->ppp->ifname)) {
+ if (all || !strcmp(f[2], pd->ppp->ses.ifname)) {
pd->temp_down_speed = 0;
pd->temp_up_speed = 0;
- triton_context_call(pd->ppp->ctrl->ctx, (triton_event_func)shaper_restore, pd);
+ triton_context_call(pd->ppp->ses.ctrl->ctx, (triton_event_func)shaper_restore, pd);
if (!all) {
found = 1;
break;
@@ -1056,13 +1056,13 @@ static void update_shaper_tr(struct shaper_pd_t *pd)
if (pd->down_speed || pd->up_speed) {
if (pd->cur_tr && pd->down_speed == pd->cur_tr->down_speed && pd->up_speed == pd->cur_tr->up_speed)
return;
- remove_shaper(pd->ppp->ifname);
+ remove_shaper(pd->ppp->ses.ifname);
}
if (pd->cur_tr && (pd->cur_tr->down_speed || pd->cur_tr->up_speed)) {
pd->down_speed = pd->cur_tr->down_speed;
pd->up_speed = pd->cur_tr->up_speed;
- if (!install_shaper(pd->ppp->ifname, pd->cur_tr->down_speed, pd->cur_tr->down_burst, pd->cur_tr->up_speed, pd->cur_tr->up_burst)) {
+ if (!install_shaper(pd->ppp->ses.ifname, pd->cur_tr->down_speed, pd->cur_tr->down_burst, pd->cur_tr->up_speed, pd->cur_tr->up_burst)) {
if (conf_verbose)
log_ppp_info2("tbf: changed shaper %i/%i (Kbit)\n", pd->cur_tr->down_speed, pd->cur_tr->up_speed);
}
@@ -1082,7 +1082,7 @@ static void time_range_begin_timer(struct triton_timer_t *t)
pthread_rwlock_rdlock(&shaper_lock);
list_for_each_entry(pd, &shaper_list, entry)
- triton_context_call(pd->ppp->ctrl->ctx, (triton_event_func)update_shaper_tr, pd);
+ triton_context_call(pd->ppp->ses.ctrl->ctx, (triton_event_func)update_shaper_tr, pd);
pthread_rwlock_unlock(&shaper_lock);
}
@@ -1096,7 +1096,7 @@ static void time_range_end_timer(struct triton_timer_t *t)
pthread_rwlock_rdlock(&shaper_lock);
list_for_each_entry(pd, &shaper_list, entry)
- triton_context_call(pd->ppp->ctrl->ctx, (triton_event_func)update_shaper_tr, pd);
+ triton_context_call(pd->ppp->ses.ctrl->ctx, (triton_event_func)update_shaper_tr, pd);
pthread_rwlock_unlock(&shaper_lock);
}
@@ -1336,7 +1336,7 @@ static void init(void)
triton_event_register_handler(EV_RADIUS_COA, (triton_event_func)ev_radius_coa);
}
#endif
- triton_event_register_handler(EV_PPP_PRE_UP, (triton_event_func)ev_ppp_pre_up);
+ triton_event_register_handler(EV_SES_PRE_UP, (triton_event_func)ev_ppp_pre_up);
triton_event_register_handler(EV_CTRL_FINISHED, (triton_event_func)ev_ctrl_finished);
triton_event_register_handler(EV_SHAPER, (triton_event_func)ev_shaper);
triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);