Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add modifiers for RTP TTL in the U/L commands #59

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ace4c8d
set the proper number of statistics to 10
razvancrainea Feb 13, 2017
402c2fc
Try to update openssl module.
sobomax Feb 14, 2017
b2b459a
No, that fid did not work.
sobomax Feb 14, 2017
797ac2b
Try to run apt-get update before and after pip.
sobomax Feb 14, 2017
3dee561
Try to install only twisted core.
sobomax Feb 14, 2017
1a8b883
GC some unused include statements.
sobomax Feb 14, 2017
8bedce4
GC unused includes.
sobomax Feb 14, 2017
484455e
GC unused includes.
sobomax Feb 14, 2017
1ec8702
Move protocol revision query command logic into its own file.
sobomax Feb 21, 2017
cb0c1d8
Re-gen.
sobomax Feb 21, 2017
c47b8c3
Add (c), add missed #include.
sobomax Feb 21, 2017
1be347d
Add -y after apt-get install.
sobomax Feb 21, 2017
c8bd8a2
Add some obscure "Dpkg::Options" into apt-get install to get rid
sobomax Feb 21, 2017
16aed8a
Revert "set the proper number of statistics to 10"
razvancrainea Feb 15, 2017
95aad9e
rtp: add modifiers for TTL in the U/L commands
razvancrainea Mar 13, 2017
35a849c
Merge branch 'master' into master-mine
razvancrainea Mar 13, 2017
7304c9a
Try to update openssl module.
sobomax Feb 14, 2017
8add3e6
No, that fid did not work.
sobomax Feb 14, 2017
97024c1
Try to run apt-get update before and after pip.
sobomax Feb 14, 2017
bbffb2a
Try to install only twisted core.
sobomax Feb 14, 2017
d510813
Move protocol revision query command logic into its own file.
sobomax Feb 21, 2017
7a9d488
Add (c), add missed #include.
sobomax Feb 21, 2017
cba4b00
Add -y after apt-get install.
sobomax Feb 21, 2017
1f4018d
Try to update openssl module.
sobomax Feb 14, 2017
cd7eea8
No, that fid did not work.
sobomax Feb 14, 2017
32de58d
Try to run apt-get update before and after pip.
sobomax Feb 14, 2017
37c026f
Try to install only twisted core.
sobomax Feb 14, 2017
76afe5e
Add some obscure "Dpkg::Options" into apt-get install to get rid
sobomax Feb 21, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions src/rtpp_command_ul.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ struct ul_opts {
int asymmetric;
int weak;
int requested_ptime;
int requested_sttl;
int requested_pttl;
char *codecs;
char *addr;
char *port;
Expand Down Expand Up @@ -119,6 +121,8 @@ ul_opts_init(struct cfg *cf, struct ul_opts *ulop)
{

ulop->asymmetric = (cf->stable->aforce != 0) ? 1 : 0;
ulop->requested_sttl = 0;
ulop->requested_pttl = 0;
ulop->requested_ptime = -1;
ulop->lia[0] = ulop->lia[1] = ulop->reply.ia = cf->stable->bindaddr[0];
ulop->lidx = 1;
Expand Down Expand Up @@ -318,6 +322,22 @@ rtpp_command_ul_opts_parse(struct cfg *cf, struct rtpp_command *cmd)
ulop->new_port = 1;
break;

case 't':
case 'T':
c = *cp;
n = strtol(cp + 1, &cp, 10);
if (n <= 0) {
RTPP_LOG(cmd->glog, RTPP_LOG_ERR, "command syntax error");
reply_error(cmd, ECODE_PARSE_13);
goto err_undo_1;
}
if (c == 't')
ulop->requested_sttl = n;
else
ulop->requested_pttl = n;
cp--;
break;

default:
RTPP_LOG(cmd->glog, RTPP_LOG_ERR, "unknown command modifier `%c'",
*cp);
Expand Down Expand Up @@ -450,8 +470,18 @@ rtpp_command_ul_handle(struct cfg *cf, struct rtpp_command *cmd, int sidx)
ulop->weak ? ( sidx ? "weak[1]" : "weak[0]" ) : "strong",
spa->strong, spa->rtp->stream[0]->weak, spa->rtp->stream[1]->weak);
}
CALL_METHOD(spa->rtp->stream[0]->ttl, reset);
CALL_METHOD(spa->rtp->stream[1]->ttl, reset);
if (ulop->requested_sttl)
CALL_METHOD(spa->rtp->stream[sidx]->ttl, reset_with,
ulop->requested_sttl);
else
CALL_METHOD(spa->rtp->stream[sidx]->ttl, reset_with,
cf->stable->max_ttl);
if (ulop->requested_pttl)
CALL_METHOD(spa->rtp->stream[pidx]->ttl, reset_with,
ulop->requested_pttl);
else
CALL_METHOD(spa->rtp->stream[pidx]->ttl, reset_with,
cf->stable->max_ttl);
RTPP_LOG(spa->log, RTPP_LOG_INFO,
"lookup on ports %d/%d, session timer restarted", spa->rtp->stream[0]->port,
spa->rtp->stream[1]->port);
Expand Down Expand Up @@ -529,6 +559,11 @@ rtpp_command_ul_handle(struct cfg *cf, struct rtpp_command *cmd, int sidx)
/* Save ref, it will be decref'd by the command disposal code */
RTPP_DBG_ASSERT(cmd->sp == NULL);
cmd->sp = spa;

if (ulop->requested_sttl)
CALL_METHOD(spa->rtp->stream[0]->ttl, reset_with, ulop->requested_sttl);
if (ulop->requested_pttl)
CALL_METHOD(spa->rtp->stream[1]->ttl, reset_with, ulop->requested_pttl);
}

if (cmd->cca.op == UPDATE) {
Expand Down
1 change: 1 addition & 0 deletions src/rtpp_command_ver.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static struct proto_cap proto_caps[] = {
{ "20150330", "Support for allocating a new port (\"Un\"/\"Ln\" commands)" },
{ "20150420", "Support for SEQ tracking and new rtpa_ counters; Q command extended" },
{ "20150617", "Support for the wildcard %%CC_SELF%% as a disconnect notify target" },
{ "20170313", "Support for changing session's ttl" },
{ NULL, NULL }
};

Expand Down