874
|
1 /*
|
|
2 * This module contains the code for enabling and disabling the receiving
|
|
3 * of various packet types via rvinterf.
|
|
4 */
|
|
5
|
|
6 #include <sys/types.h>
|
|
7 #include <stdio.h>
|
|
8 #include <ctype.h>
|
|
9 #include <string.h>
|
|
10 #include <strings.h>
|
|
11 #include <stdlib.h>
|
|
12 #include "pktmux.h"
|
|
13 #include "localsock.h"
|
|
14
|
|
15 void
|
|
16 send_rxctl_cmd(channel, enable)
|
|
17 {
|
|
18 u_char cmdbuf[2];
|
|
19
|
|
20 cmdbuf[0] = enable ? CLI2RVI_WANT_MUXPROTO : CLI2RVI_DROP_MUXPROTO;
|
|
21 cmdbuf[1] = channel;
|
|
22 send_init_command(cmdbuf, 2);
|
|
23 }
|
|
24
|
|
25 void
|
|
26 ati_rx_control(newstate)
|
|
27 {
|
|
28 static int state = 0;
|
|
29
|
|
30 if (state == newstate)
|
|
31 return;
|
|
32 send_rxctl_cmd(RVT_AT_HEADER, newstate);
|
|
33 state = newstate;
|
|
34 }
|
|
35
|
|
36 void
|
|
37 gpf_rx_control(newstate)
|
|
38 {
|
|
39 static int state = 0;
|
|
40
|
|
41 if (state == newstate)
|
|
42 return;
|
|
43 send_rxctl_cmd(RVT_L23_HEADER, newstate);
|
|
44 state = newstate;
|
|
45 }
|
|
46
|
|
47 void
|
1011
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
diff
changeset
|
48 tch_rx_control(newstate)
|
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
diff
changeset
|
49 {
|
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
diff
changeset
|
50 static int state = 0;
|
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
diff
changeset
|
51
|
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
diff
changeset
|
52 if (state == newstate)
|
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
diff
changeset
|
53 return;
|
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
diff
changeset
|
54 send_rxctl_cmd(RVT_TCH_HEADER, newstate);
|
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
diff
changeset
|
55 state = newstate;
|
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
diff
changeset
|
56 }
|
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
diff
changeset
|
57
|
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
diff
changeset
|
58 void
|
874
|
59 rxctl_user_cmd(args, enable)
|
|
60 char *args;
|
|
61 {
|
|
62 char *cp, *np;
|
|
63 int gotsome = 0;
|
|
64
|
|
65 for (cp = args; ; ) {
|
|
66 while (isspace(*cp))
|
|
67 cp++;
|
|
68 if (!*cp) {
|
|
69 if (!gotsome)
|
|
70 printf("error: argument required\n");
|
|
71 return;
|
|
72 }
|
|
73 for (np = cp; *cp && !isspace(*cp); cp++)
|
|
74 ;
|
|
75 if (*cp)
|
|
76 *cp++ = '\0';
|
|
77 if (!strcmp(np, "ati"))
|
|
78 ati_rx_control(enable);
|
|
79 else if (!strcmp(np, "gpf"))
|
|
80 gpf_rx_control(enable);
|
1011
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
diff
changeset
|
81 else if (!strcmp(np, "tch"))
|
820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
Mychaela Falconia <falcon@ivan.Harhan.ORG>
diff
changeset
|
82 tch_rx_control(enable);
|
874
|
83 else {
|
|
84 printf("error: unknown channel \"%s\"\n", np);
|
|
85 return;
|
|
86 }
|
876
c9f353b5d70c
rvinterf/asyncshell/rxctl.c: buglet in the implementation of dis/enable commands
Space Falcon <falcon@ivan.Harhan.ORG>
diff
changeset
|
87 gotsome++;
|
874
|
88 }
|
|
89 }
|
|
90
|
|
91 void
|
|
92 cmd_enable(args)
|
|
93 char *args;
|
|
94 {
|
|
95 rxctl_user_cmd(args, 1);
|
|
96 }
|
|
97
|
|
98 void
|
|
99 cmd_disable(args)
|
|
100 char *args;
|
|
101 {
|
|
102 rxctl_user_cmd(args, 0);
|
|
103 }
|