Revision b4050b19
README | ||
---|---|---|
1 |
### Dependencies |
|
2 |
|
|
3 |
This software requires the following libraries: |
|
4 |
|
|
5 |
argparse_actions |
|
6 |
pyroute2 |
|
7 |
portalocker |
|
8 |
serf-python |
|
9 |
|
|
10 |
|
|
11 |
### Usage examples |
|
12 |
|
|
13 |
In all the examples that follow we assume we want to use "psngc" as the channels |
|
14 |
tag name (specified with option -t) and that the RPC deamon responds at address |
|
15 |
127.0.0.1 on port 7373 (specified with options -a and -p respectively). |
|
16 |
|
|
17 |
## Add a new channel |
|
18 |
|
|
19 |
Suppose you want to add a new channel named "Channel1" and whose source IP |
|
20 |
address and port are 192.168.100.2 and 6000 respectively. Then you execute the |
|
21 |
following command: |
|
22 |
|
|
23 |
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 \ |
|
24 |
set 192.168.100.2 6000 "Channel1" "Reserved" |
|
25 |
|
|
26 |
The last string "Reserved" can be used to specify any additional parameters that |
|
27 |
can be useful for whoever will receive this channel. |
|
28 |
|
|
29 |
NOTE: It is not possible to add two different channel that use the same address |
|
30 |
and port. This contraint is verified only on the local node, this means that is |
|
31 |
responsibility of the local node to use the correct source channel IP address. |
|
32 |
|
|
33 |
NOTE: Adding a new channel propagates a member-update event on the Serf network. |
|
34 |
If the channel already exist on the list of channels of the local node, then the |
|
35 |
member-update event is not generated. |
|
36 |
|
|
37 |
|
|
38 |
## Delete a channel |
|
39 |
|
|
40 |
Channel deletion is based exclusively on the source IP address and port of a |
|
41 |
channel. The channel name and the "Reserved" string are ignored. Suppose you |
|
42 |
want to delete the channel that was added in the previous example (address |
|
43 |
192.168.100.2 and port 6000). The you execute the following command: |
|
44 |
|
|
45 |
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 \ |
|
46 |
del 192.168.100.2 6000 |
|
47 |
|
|
48 |
NOTE: Deleting a channel propagates a member-update event on the Serf network. |
|
49 |
If the channel is not present in the list of channels that belong to the local |
|
50 |
node, then the member-update event is not generated. |
|
51 |
|
|
52 |
|
|
53 |
## Running the software in background |
|
54 |
|
|
55 |
All the nodes that are interested in keepeing an updted list of channels |
|
56 |
existing on the network should run the software in background mode with the |
|
57 |
following command: |
|
58 |
|
|
59 |
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 \ |
|
60 |
bg /tmp/channels.db |
|
61 |
|
|
62 |
the path specified at the end of the command is the channels database file that |
|
63 |
the software will use to list the existing channels. This file is written for |
|
64 |
the first time when the software starts and is updated everytime a channel is |
|
65 |
added or deleted (this is known by listening to the member-update events). The |
|
66 |
software use an exclusive file system file lock every time the file is updated. |
|
67 |
The file is formatted by an header line (starting with the character "#") and by |
|
68 |
a list of zero or more channels. Here an examples of the channels database file |
|
69 |
containing two channels: |
|
70 |
|
|
71 |
# channel_name,source_addr,source_port,channel_params |
|
72 |
Channel1,192.168.100.2,6000,Reserved |
|
73 |
Cool Channel,192.168.100.3,7000,720p h264 |
|
74 |
|
README.md | ||
---|---|---|
1 |
# Dependencies |
|
2 |
|
|
3 |
This software requires the following libraries: argparse\_actions, pyroute2, |
|
4 |
portalocker, serf-python. |
|
5 |
|
|
6 |
# Usage examples |
|
7 |
|
|
8 |
In all the examples that follow we assume we want to use "psngc" as the channels |
|
9 |
tag name (specified with option -t) and that the RPC deamon responds at address |
|
10 |
127.0.0.1 on port 7373 (specified with options -a and -p respectively). |
|
11 |
|
|
12 |
# Add a new channel |
|
13 |
|
|
14 |
Suppose you want to add a new channel named "Channel1" and whose source IP |
|
15 |
address and port are 192.168.100.2 and 6000 respectively. Then you execute the |
|
16 |
following command: |
|
17 |
|
|
18 |
``` |
|
19 |
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 set 192.168.100.2 6000 "Channel1" "Reserved" |
|
20 |
``` |
|
21 |
|
|
22 |
The last string "Reserved" can be used to specify any additional parameters that |
|
23 |
can be useful for whoever will receive this channel. |
|
24 |
|
|
25 |
NOTE: It is not possible to add two different channel that use the same address |
|
26 |
and port. This contraint is verified only on the local node, this means that is |
|
27 |
responsibility of the local node to use the correct source channel IP address. |
|
28 |
|
|
29 |
NOTE: Adding a new channel propagates a member-update event on the Serf network. |
|
30 |
If the channel already exist on the list of channels of the local node, then the |
|
31 |
member-update event is not generated. |
|
32 |
|
|
33 |
|
|
34 |
# Delete a channel |
|
35 |
|
|
36 |
Channel deletion is based exclusively on the source IP address and port of a |
|
37 |
channel. The channel name and the "Reserved" string are ignored. Suppose you |
|
38 |
want to delete the channel that was added in the previous example (address |
|
39 |
192.168.100.2 and port 6000). The you execute the following command: |
|
40 |
|
|
41 |
``` |
|
42 |
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 del 192.168.100.2 6000 |
|
43 |
``` |
|
44 |
|
|
45 |
NOTE: Deleting a channel propagates a member-update event on the Serf network. |
|
46 |
If the channel is not present in the list of channels that belong to the local |
|
47 |
node, then the member-update event is not generated. |
|
48 |
|
|
49 |
|
|
50 |
# Running the software in background |
|
51 |
|
|
52 |
All the nodes that are interested in keepeing an updted list of channels |
|
53 |
existing on the network should run the software in background mode with the |
|
54 |
following command: |
|
55 |
|
|
56 |
``` |
|
57 |
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 bg /tmp/channels.db |
|
58 |
``` |
|
59 |
|
|
60 |
the path specified at the end of the command is the channels database file that |
|
61 |
the software will use to list the existing channels. This file is written for |
|
62 |
the first time when the software starts and is updated everytime a channel is |
|
63 |
added or deleted (this is known by listening to the member-update events). The |
|
64 |
software use an exclusive file system file lock every time the file is updated. |
|
65 |
The file is formatted by an header line (starting with the character "#") and by |
|
66 |
a list of zero or more channels. Here an examples of the channels database file |
|
67 |
containing two channels: |
|
68 |
|
|
69 |
\# channel\_name,source\_addr,source\_port,channel\_params |
|
70 |
Channel1,192.168.100.2,6000,Reserved |
|
71 |
Cool Channel,192.168.100.3,7000,720p h264 |
|
72 |
|
Also available in: Unified diff