Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit76609e8

Browse files
committed
Add T[r]XXX sub-command.
PR:#59
1 parentb70f6a1 commit76609e8

File tree

5 files changed

+132
-1
lines changed

5 files changed

+132
-1
lines changed

‎src/Makefile.am‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ BASE_SOURCES=main.c rtp.h rtpp_server.c rtpp_pthread.c rtpp_pthread.h \
6161
rtpp_nofile.c rtpp_nofile.h rtpp_record_adhoc.h\
6262
$(CMDSRCDIR)/rpcpv1_norecord.c$(CMDSRCDIR)/rpcpv1_norecord.h\
6363
$(CMDSRCDIR)/rpcpv1_ul_subc.c$(CMDSRCDIR)/rpcpv1_ul_subc.h\
64+
$(CMDSRCDIR)/rpcpv1_ul_subc_ttl.c$(CMDSRCDIR)/rpcpv1_ul_subc_ttl.h\
6465
$(RTPP_AUTOSRC_SOURCES) rtpp_epoll.c
6566
ADV_DIR=$(top_srcdir)/src/advanced
6667
BASE_SOURCES+=$(ADV_DIR)/packet_observer.h$(ADV_DIR)/pproc_manager.c\

‎src/commands/rpcpv1_ul_subc.c‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2020 Sippy Software, Inc., http://www.sippysoft.com
2+
* Copyright (c) 2006-2021 Sippy Software, Inc., http://www.sippysoft.com
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -31,17 +31,20 @@
3131
#include"rtpp_types.h"
3232
#include"rtpp_cfg.h"
3333
#include"rtpp_util.h"
34+
#include"rtpp_mallocs.h"
3435
#include"rtpp_modman.h"
3536
#include"rtpp_command_args.h"
3637
#include"commands/rpcpv1_ul.h"
3738
#include"commands/rpcpv1_ul_subc.h"
39+
#include"commands/rpcpv1_ul_subc_ttl.h"
3840

3941
int
4042
rtpp_subcommand_ul_opts_parse(conststructrtpp_cfg*cfsp,
4143
conststructrtpp_command_args*subc_args,structafter_success_h*asp)
4244
{
4345
intmod_id,inst_id;
4446
constchar*cp;
47+
structrtpp_subcommand_ttlttl_arg,*tap;
4548

4649
switch(subc_args->v[0][0]) {
4750
case'M':
@@ -57,6 +60,29 @@ rtpp_subcommand_ul_opts_parse(const struct rtpp_cfg *cfsp,
5760
return (-1);
5861
break;
5962

63+
case'T':
64+
case't':
65+
if (subc_args->c!=1)
66+
return (-1);
67+
cp=&subc_args->v[0][1];
68+
if (cp[0]=='r'||cp[0]=='R') {
69+
ttl_arg.direction=TTL_REVERSE;
70+
cp+=1;
71+
}else {
72+
ttl_arg.direction=TTL_FORWARD;
73+
}
74+
if (atoi_safe(cp,&ttl_arg.ttl)!=ATOI_OK)
75+
return (-1);
76+
if (ttl_arg.ttl <=0)
77+
return (-1);
78+
tap=rtpp_zmalloc(sizeof(ttl_arg));
79+
if (tap==NULL)
80+
return (-1);
81+
*tap=ttl_arg;
82+
asp->args.dyn=tap;
83+
asp->handler=rtpp_subcommand_ttl_handler;
84+
break;
85+
6086
default:
6187
return (-1);
6288
}

‎src/commands/rpcpv1_ul_subc_ttl.c‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (c) 2021 Sippy Software, Inc., http://www.sippysoft.com
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23+
* SUCH DAMAGE.
24+
*
25+
*/
26+
27+
#include<stdint.h>
28+
#include<stdlib.h>
29+
30+
#include"rtpp_types.h"
31+
#include"rtpp_stream.h"
32+
#include"rtpp_ttl.h"
33+
#include"rtpp_command_sub.h"
34+
#include"commands/rpcpv1_ul.h"
35+
#include"commands/rpcpv1_ul_subc_ttl.h"
36+
37+
int
38+
rtpp_subcommand_ttl_handler(conststructafter_success_h_args*ashap,
39+
conststructrtpp_subc_ctx*rscp)
40+
{
41+
conststructrtpp_subcommand_ttl*tap;
42+
structrtpp_stream*strmp;
43+
44+
tap= (structrtpp_subcommand_ttl*)ashap->dyn;
45+
switch (tap->direction) {
46+
caseTTL_FORWARD:
47+
strmp=rscp->strmp_in;
48+
break;
49+
50+
caseTTL_REVERSE:
51+
strmp=rscp->strmp_out;
52+
if (strmp==NULL)
53+
return (-1);
54+
break;
55+
56+
default:
57+
abort();
58+
}
59+
60+
CALL_SMETHOD(strmp->ttl,reset_with,tap->ttl);
61+
return (0);
62+
}

‎src/commands/rpcpv1_ul_subc_ttl.h‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2021 Sippy Software, Inc., http://www.sippysoft.com
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23+
* SUCH DAMAGE.
24+
*
25+
*/
26+
27+
structrtpp_subc_ctx;
28+
structafter_success_h_args;
29+
30+
enumrtpp_subcommand_ttl_direction {
31+
TTL_FORWARD=0,
32+
TTL_REVERSE=1
33+
};
34+
35+
structrtpp_subcommand_ttl {
36+
intttl;
37+
enumrtpp_subcommand_ttl_directiondirection;
38+
};
39+
40+
intrtpp_subcommand_ttl_handler(conststructafter_success_h_args*,
41+
conststructrtpp_subc_ctx*);

‎src/commands/rpcpv1_ver.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static struct proto_cap proto_caps[] = {
6262
{"20150617","Support for the wildcard %%CC_SELF%% as a disconnect notify target" },
6363
{"20191015","Support for the && sub-command specifier" },
6464
{"20200226","Support for the N command to stop recording" },
65+
{"20210524","Support for changing session's ttl" },
6566
{NULL,NULL }
6667
};
6768

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp