Compare commits

..

121 Commits

Author SHA1 Message Date
3a97ad2d3c Update 'README.md'
Update Readme
2021-10-11 20:41:07 -04:00
c1ebca9919 Update 'README.md'
Update MD
2021-10-11 20:40:32 -04:00
Randy Hall
c05d8fed5a
Merge pull request #10 from kf7eel/patch-1
forward CSBK to destination TG
2021-02-28 08:18:34 -08:00
KF7EEL
9d49106a5f forward CSBK to destination TG 2021-02-26 16:16:15 -08:00
Randy Hall
539f8a7fcd
Merge pull request #6 from kf7eel/master
fix typo (CSBK packet types). Does not fundamentally change the script, since CSBK packets aren't processed.
2020-11-23 20:28:14 -08:00
KF7EEL
bfff0abacd fix typo 2020-11-21 22:42:05 -08:00
Randy Hall
04e220de86
Merge pull request #2 from K2IE/master
Restored XLXPEER Functionality. Not actually cruft after all.
2020-10-24 21:58:42 -07:00
Dan Srebnick (K2IE)
948a2a7bbc Cosmetics 2020-10-24 21:20:22 -04:00
Dan Srebnick (K2IE)
951f39f3db Re-add needed code removed when diffing to restore XLX 2020-10-24 21:14:06 -04:00
Dan Srebnick (K2IE)
4b9864671e Restore XLXPEER functionality 2020-10-24 20:53:48 -04:00
Cort Buffington
d0d496b232 Add necessary pieces for Talker Alias DMRA 2020-10-15 16:23:55 -05:00
n0mjs710
51ecece8dc Add DMRA Framework 2020-10-13 18:59:28 -05:00
n0mjs710
ce494a4a18 Delete hblink-800.cfg 2020-10-12 08:30:42 -05:00
n0mjs710
819c3bae30 remove cruft 2020-10-12 08:29:50 -05:00
n0mjs710
a16e426c55 Merge branch 'master' of https://github.com/n0mjs710/hblink3 2020-10-12 08:27:07 -05:00
n0mjs710
a12b144c7c Options added 2020-10-12 08:27:03 -05:00
Cort Buffington
c8e1d88ecc Merge branch 'master' of https://github.com/n0mjs710/hblink3 2020-10-12 06:37:40 -05:00
Cort Buffington
89040e7c14 Remove Cruft 2020-10-12 06:37:21 -05:00
Cort Buffington
d68241918b
Merge pull request #18 from n0mjs710/private-call-dev
Private call dev
2020-10-11 07:54:40 -05:00
Cort Buffington
ccfd862a0a Fixed Private Call Bridging when BOTH_SLOTS selected
This is the problem where bridge.py is told to send private calls marked with EITHER timeslot over openbridge. Packets weren't assembled correctly when the BOTH_SLOTS option was set True in the hblink configuraiton file.
d:
#	modified:   bridge.py
#	modified:   hblink.py
#
# Changes not staged for commit:
#	modified:   .gitattributes
#	modified:   Dockerfile
#	modified:   voice_lib.py
#
2020-04-27 11:01:54 -05:00
n0mjs710
24dca2e6ad Fixed assignment typos
[_stream_id]['ACTIVE']: False
to
[_stream_id]['ACTIVE'] = False

Thanks, Steve!
2020-03-18 09:32:32 -05:00
Cort Buffington
8c1e9e5185 update coypright years 2020-03-16 14:35:28 +00:00
Cort Buffington
a2c0bb54c6 Fixed typo in call state tracking. 2020-03-16 08:38:16 -05:00
Cort Buffington
03f9c81d3a Merge branch 'private-call-dev' of https://github.com/n0mjs710/hblink3 into private-call-dev 2020-03-15 21:23:05 -05:00
Cort Buffington
fdbfbf2362 READY FOR TESTING
unit calls should be working on HBP and OBP systems. Also adds the ability to send TS data in OBP for unit calls to preserve timeslot routing for unit calls.
2020-03-15 21:23:03 -05:00
Cort Buffington
b48e522f85 Now working version of private call routing, on a per-system basis, with the ability to overload OBP with TS information for unit calls. 2020-03-16 02:20:24 +00:00
Cort Buffington
f00d29e8a0 Update to sync dev system
message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch private-call-dev
# Your branch is ahead of 'origin/private-call-dev' by 1 commit.
#   (use "git push" to publish your local commits)
#
2020-03-14 10:56:16 -05:00
Cort Buffington
08f6669bd3
Update README.md 2020-03-11 09:47:39 -05:00
Cort Buffington
8497bb1462
Update README.md 2020-03-11 09:46:54 -05:00
Cort Buffington
ac87c44917
Update README.md 2020-03-11 09:46:29 -05:00
Cort Buffington
8f0a3d02a5
Update README.md 2020-03-11 09:46:11 -05:00
Cort Buffington
d31c6f7fe7
Update README.md 2020-03-11 09:45:09 -05:00
n0mjs710
e1174e6aba Added IP address logging for denied registration 2020-03-09 13:28:11 -05:00
Cort Buffington
e8f838b3d6
Update README.md 2020-03-07 14:08:29 -06:00
Cort Buffington
7f7f8bdf74 Adding Official Logo Images 2020-03-06 07:31:12 -06:00
Cort Buffington
21c6bf9281 save of incremental work 2020-03-03 22:51:50 +00:00
Cort Buffington
4e3a13daaf fixing typos on obp call tracking 2020-02-19 19:27:37 +00:00
Cort Buffington
9e2876dfae update 2020-02-18 18:11:19 +00:00
Cort Buffington
c246f3e5db Merge branch 'private-call-dev' of https://github.com/n0mjs710/hblink3 into private-call-dev 2020-02-17 19:20:19 -06:00
Cort Buffington
21f9c680be update sample config 2020-02-17 19:20:10 -06:00
Cort Buffington
50387c2133 update 2020-02-18 01:18:11 +00:00
n0mjs710
41f04dc28b Skeleton App for Data Development 2020-02-11 14:24:29 -06:00
n0mjs710
d44a181c06 create blank app template 2020-02-10 10:11:11 -06:00
n0mjs710
383ba7e0ae Create an "app template"
this should make it easier to build new or test applications.
2020-02-10 10:09:40 -06:00
Cort Buffington
7fc4ce0495 Merge branch 'private-call-dev' of https://github.com/n0mjs710/hblink3 into private-call-dev
As a result of rebasing.
2020-02-09 19:53:31 -06:00
Cort Buffington
4aa5210f5b Update bridge.py 2020-02-09 19:51:58 -06:00
Cort Buffington
3d9aa41fcb Update bridge.py 2020-02-09 19:51:58 -06:00
Cort Buffington
2fa615dd37 Update bridge.py 2020-02-09 19:51:58 -06:00
Cort Buffington
35ba251e71 Update bridge.py 2020-02-09 19:51:58 -06:00
Cort Buffington
30ed93aa30 Update bridge.py 2020-02-09 19:51:58 -06:00
Cort Buffington
508b9c7197 Update bridge.py 2020-02-09 19:51:58 -06:00
Cort Buffington
ed2a1ca549 Update bridge.py 2020-02-09 19:51:58 -06:00
Cort Buffington
e6949e65ec Revert "Update bridge.py"
This reverts commit ab1a536147.
2020-02-09 19:51:58 -06:00
Cort Buffington
9ac426aa2d Revert "Update bridge.py"
This reverts commit 0a2edc09a5.
2020-02-09 19:51:58 -06:00
Cort Buffington
94afc15d7a Update bridge.py 2020-02-09 19:51:58 -06:00
Cort Buffington
b5e77e64b1 Update bridge.py 2020-02-09 19:51:58 -06:00
Cort Buffington
8c2b35ece0 Update bridge.py 2020-02-09 19:51:58 -06:00
Cort Buffington
bb4356e027 Update bridge.py 2020-02-09 19:51:58 -06:00
Cort Buffington
63604a5b38 inbound OBP Unit calls 2020-02-09 19:51:58 -06:00
Cort Buffington
4643ea47b7 Inbound OBP Unit calls 2020-02-09 19:51:58 -06:00
Cort Buffington
877e1c6c65 Adding inbound OBP Processing 2020-02-09 19:51:58 -06:00
n0mjs710
364ead81ec Working Code - REPORT ERRORS! 2020-02-09 19:51:58 -06:00
Cort Buffington
717e802b9b fixed missing ) on logging line 2020-02-09 19:51:58 -06:00
n0mjs710
857c4d09d0 untested OBP support added
Push is just to sync with a test system.
2020-02-09 19:51:58 -06:00
n0mjs710
2e09350ad2 OBP Support Added -- CURRENTLY UNTESTED
OpenBridge support added, but not yet tested. This push is so that I can pick up my updates on another computer to test.
2020-02-09 19:51:58 -06:00
Cort Buffington
836c655739 add configuration to enable unit routing 2020-02-09 19:51:58 -06:00
Cort Buffington
281860db0b unit to unit calls, with contention working - HBSystems only
This appears to work, but no openbridge support yet.
2020-02-09 19:51:58 -06:00
Cort Buffington
0f38427f2f Works, but no contention handler
Private call forwarding works, with destionation routing cache, but no contention handler yet.
2020-02-09 19:51:58 -06:00
Cort Buffington
112143ec05 incremental update - Not Working
the program runs at ths point, logging is updated for group calls, no errors in unit sectinon, but no contention handler and send routines not yet built.
2020-02-09 19:51:58 -06:00
Cort Buffington
887657aa16 Track subscribers
this is not yet really useable, just getting the mechanics started
2020-02-09 19:51:58 -06:00
Cort Buffington
7bf0a77e16 Separate UNIT from GROUP Calls
Initial framework for processing UNIT calls
2020-02-09 19:51:58 -06:00
Cort Buffington
28f006b493 Update bridge.py 2020-02-09 17:08:32 -06:00
Cort Buffington
99c76b44de Update bridge.py 2020-02-09 16:33:46 -06:00
Cort Buffington
b9dc33dae5
Update README.md 2020-02-06 15:30:53 -06:00
Cort Buffington
58c84cf43a Changed initial state values for some reporting variables. Cosmetic, but avoids unecessary tracabacks. 2020-01-13 14:45:17 +00:00
Cort Buffington
ef4514b8e0 updated commented debugging message at line #355 to remove unnecessary type conversion for _seq 2019-12-15 16:55:19 +00:00
Cort Buffington
96514de5cc Fixed unecessary type conversion in commended debug logging at line #355 2019-12-15 16:52:14 +00:00
Cort Buffington
cdae79e0ee
Merge pull request #11 from kc1awv/patch-1
fix typo
2019-12-13 10:00:16 -06:00
Steve Miller
429287452a
fix typo
missing bracket on line 89
2019-12-13 10:54:04 -05:00
Cort Buffington
3cb00bc5bd Update bridge.py 2019-12-04 19:13:13 -06:00
Cort Buffington
d68d3582da Update bridge.py 2019-12-04 19:07:58 -06:00
Cort Buffington
3d5437e9a0 Update bridge.py 2019-12-04 19:06:57 -06:00
Cort Buffington
e00a98f7d2 Update bridge.py 2019-12-04 19:05:48 -06:00
Cort Buffington
053914a68b Update bridge.py 2019-12-04 19:02:24 -06:00
Cort Buffington
76143f718c Revert "Update bridge.py"
This reverts commit ab1a536147.
2019-12-04 19:00:13 -06:00
Cort Buffington
83d120c101 Revert "Update bridge.py"
This reverts commit 0a2edc09a5.
2019-12-04 18:59:55 -06:00
Cort Buffington
0a2edc09a5 Update bridge.py 2019-12-04 18:57:44 -06:00
Cort Buffington
ab1a536147 Update bridge.py 2019-12-04 18:51:42 -06:00
Cort Buffington
e6d25534b5 Update bridge.py 2019-12-04 18:48:51 -06:00
Cort Buffington
9219b4b2ee Update bridge.py 2019-12-04 18:45:22 -06:00
Cort Buffington
da607cd542 inbound OBP Unit calls 2019-12-04 17:25:50 -06:00
Cort Buffington
83299312cc Inbound OBP Unit calls 2019-12-04 17:23:04 -06:00
Cort Buffington
8bbd9ee850 Adding inbound OBP Processing 2019-12-04 17:12:26 -06:00
n0mjs710
999bbbf5f7 Working Code - REPORT ERRORS! 2019-12-03 13:11:01 -06:00
Cort Buffington
76bb7f1140 fixed missing ) on logging line 2019-12-02 19:56:41 -06:00
Cort Buffington
ece48f3a50 Merge branch 'private-call-dev' of https://github.com/n0mjs710/hblink3 into private-call-dev 2019-12-02 19:49:47 -06:00
Cort Buffington
1bc57b5ea4 add configuration to enable unit routing 2019-12-02 19:49:37 -06:00
n0mjs710
9e2d2315da untested OBP support added
Push is just to sync with a test system.
2019-12-02 08:30:25 -06:00
n0mjs710
3893e12fca OBP Support Added -- CURRENTLY UNTESTED
OpenBridge support added, but not yet tested. This push is so that I can pick up my updates on another computer to test.
2019-12-02 08:29:52 -06:00
Cort Buffington
8a45e927ae unit to unit calls, with contention working - HBSystems only
This appears to work, but no openbridge support yet.
2019-12-01 13:27:07 -06:00
Cort Buffington
f98c12096c Works, but no contention handler
Private call forwarding works, with destionation routing cache, but no contention handler yet.
2019-12-01 11:20:14 -06:00
Cort Buffington
e5eafeec3e incremental update - Not Working
the program runs at ths point, logging is updated for group calls, no errors in unit sectinon, but no contention handler and send routines not yet built.
2019-12-01 10:06:08 -06:00
Cort Buffington
d8bfdc7068 Track subscribers
this is not yet really useable, just getting the mechanics started
2019-11-29 10:35:27 -06:00
Cort Buffington
d689a876aa Separate UNIT from GROUP Calls
Initial framework for processing UNIT calls
2019-11-28 10:49:32 -06:00
Cort Buffington
31c23ae7a0 Fixed unecessary bytes to int conversion of sequence field -- used for loss reporting 2019-11-20 14:52:24 +00:00
n0mjs710
3878c82513 Add ability to specify a rules file on the CLI 2019-10-07 09:52:33 -05:00
n0mjs710
96b029a927 Cleaned up Processing and logging 2019-09-30 14:10:40 -05:00
n0mjs710
2ef0dfcd74 Fix ACL logging - SLOT specifig logging had quietly been broken 2019-09-25 14:36:20 -05:00
n0mjs710
1b265d8368 Initial Upload -- seems to work. 2019-09-25 09:56:03 -05:00
Cort Buffington
84800d690a
Merge pull request #8 from millaguie/docker
Add support for configuration from directory instead a git repo
2019-09-22 11:29:05 -05:00
Millaguie
9ba975bfff Add support for configuration from directory instead a git repo 2019-09-22 18:17:10 +02:00
Cort Buffington
e570adbef0 Remove print() used for debugging 2019-09-18 23:45:32 +00:00
Cort Buffington
99d0b49559 convert seq from bytes to int so we can actually use it 2019-09-11 09:24:54 -05:00
Cort Buffington
d3a5ee2221 Fixed reference to STRING_TO to be const.STRING_TO 2019-09-07 13:31:37 +00:00
n0mjs710
557b21c022 Remove unnecessary state variables 2019-09-06 13:43:24 -05:00
n0mjs710
553bcba3a2 Contention Handler logging error fixed (lots of them) 2019-09-06 13:02:39 -05:00
n0mjs710
101a6e4a11 Fix typo in contention handler logging 2019-09-06 12:49:13 -05:00
n0mjs710
55a546a239 Added Contention Handler & Target Iteration to continue not return 2019-09-06 10:18:24 -05:00
n0mjs710
64a685cd80 1st Working Version
May still have issues, definitley needs improvement.
2019-09-06 09:06:37 -05:00
n0mjs710
aefedca6ee 1st attempt at an operational upload 2019-09-05 12:51:29 -05:00
n0mjs710
be13083729 Create bridge_all.py
NO GUARANTEES. It still has some python2 code that needs updated, but it's here while I work on it.
2019-09-05 08:46:28 -05:00
22 changed files with 1786 additions and 1176 deletions

0
.gitattributes vendored Normal file → Executable file
View File

1
.gitignore vendored
View File

@ -90,7 +90,6 @@ ENV/
.DS_Store .DS_Store
hblink.cfg hblink.cfg
deconstructor.cfg
*.config *.config
*.bak *.bak
rules.py rules.py

View File

@ -1,32 +0,0 @@
FROM python:3.7-slim-stretch
RUN apt update && \
apt install -y git && \
cd /usr/src/ && \
git clone https://github.com/n0mjs710/dmr_utils3 && \
cd /usr/src/dmr_utils3 && \
./install.sh && \
rm -rf /var/lib/apt/lists/* && \
cd /opt && \
rm -rf /usr/src/dmr_utils3 && \
git clone https://github.com/n0mjs710/hblink3
RUN cd /opt/hblink3/ && \
sed -i s/.*python.*//g requirements.txt && \
pip install --no-cache-dir -r requirements.txt
ADD entrypoint /entrypoint
RUN adduser -u 54000 radio && \
adduser radio radio && \
chmod 755 /entrypoint && \
chown radio:radio /entrypoint && \
chown radio /opt/hblink3
RUN chmod 755 /entrypoint
USER radio
EXPOSE 54000
ENTRYPOINT [ "/entrypoint" ]

BIN
HBlink.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

245
HBlink.svg Normal file
View File

@ -0,0 +1,245 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
inkscape:version="1.0beta1 (d565813, 2019-09-28)"
sodipodi:docname="HBlink.svg"
id="svg877"
height="411.17413"
width="1042.9242"
viewBox="49.656 217.125 1042.9242 411.17414"
version="1.1">
<sodipodi:namedview
inkscape:current-layer="svg877"
inkscape:window-maximized="0"
inkscape:window-y="23"
inkscape:window-x="583"
inkscape:cy="48.366866"
inkscape:cx="574.39926"
inkscape:zoom="1"
fit-margin-left="5"
fit-margin-bottom="5"
fit-margin-right="5"
fit-margin-top="5"
units="px"
inkscape:pagecheckerboard="true"
showgrid="false"
id="namedview879"
inkscape:window-height="1348"
inkscape:window-width="1943"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10"
gridtolerance="10"
objecttolerance="10"
borderopacity="1"
inkscape:document-rotation="0"
bordercolor="#666666"
pagecolor="#ffffff" />
<defs
id="defs837">
<font-face
overline-thickness="0"
overline-position="0"
strikethrough-thickness="0"
strikethrough-position="0"
v-hanging="0"
v-mathematical="0"
v-alphabetic="0"
v-ideographic="0"
hanging="0"
mathematical="0"
alphabetic="0"
ideographic="0"
accent-height="0"
stemh="0"
stemv="0"
id="font-face833"
font-weight="400"
descent="-255.00488"
ascent="945.0073"
cap-height="669"
x-height="669"
slope="0"
underline-thickness="20"
underline-position="-133"
units-per-em="1000"
panose-1="2 0 6 0 0 0 0 0 0 0"
font-size="96"
font-family="Ethnocentric">
<font-face-src>
<font-face-name
name="EthnocentricRg-Regular" />
</font-face-src>
</font-face>
<font-face
overline-thickness="0"
overline-position="0"
strikethrough-thickness="0"
strikethrough-position="0"
v-hanging="0"
v-mathematical="0"
v-alphabetic="0"
v-ideographic="0"
hanging="0"
mathematical="0"
alphabetic="0"
ideographic="0"
accent-height="0"
stemh="0"
stemv="0"
id="font-face835"
font-weight="400"
descent="-255.00488"
ascent="945.0073"
cap-height="669"
x-height="669"
slope="0"
underline-thickness="20"
underline-position="-133"
units-per-em="1000"
panose-1="2 0 6 0 0 0 0 0 0 0"
font-size="48"
font-family="Ethnocentric">
<font-face-src>
<font-face-name
name="EthnocentricRg-Regular" />
</font-face-src>
</font-face>
</defs>
<metadata
id="metadata839"> Produced by OmniGraffle 7.12.1
<dc:date>2018-03-14 13:37:44 +0000</dc:date>
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="matrix(3.5262508,0,0,3.5262508,-159.40153,-655.56235)"
stroke-opacity="1"
stroke="none"
stroke-dasharray="none"
fill-opacity="1"
fill="none"
id="Canvas_2">
<title
id="title841">Canvas 2</title>
<g
id="Canvas_2: Layer 1">
<title
id="title843">Layer 1</title>
<g
id="Group_40">
<g
id="Graphic_39">
<title
id="title845">path6007</title>
<path
inkscape:connector-curvature="0"
id="path847"
stroke-width="3"
stroke-linejoin="round"
stroke-linecap="round"
stroke="#009051"
d="m 72.52062,328.5 h 225.5218 c 6.17355,0 11.1782,5.00465 11.1782,11.1782 v 0 c 0,6.17355 -5.00465,11.1782 -11.1782,11.1782 H 72.52062 c -6.17355,0 -11.1782,-5.00465 -11.1782,-11.1782 v 0 c 0,-6.17355 5.00465,-11.1782 11.1782,-11.1782 z" />
</g>
<g
id="Graphic_38">
<g
style="fill:#009051"
id="text852"
transform="translate(54.656,222.125)"
aria-label="HB">
<path
inkscape:connector-curvature="0"
id="path881"
style="font-weight:400;font-size:96px;font-family:Ethnocentric;fill:#009051"
d="M 84,91 H 64.224 V 66.232 H 26.016 V 91 H 6.048 V 26.776 H 26.016 V 49.528 H 64.224 V 26.776 H 84 Z" />
<path
inkscape:connector-curvature="0"
id="path883"
style="font-weight:400;font-size:96px;font-family:Ethnocentric;fill:#009051"
d="m 168.7155,57.976 q 4.224,1.248 7.104,4.896 2.976,3.648 2.976,9.408 0,4.032 -1.248,7.488 -1.248,3.36 -4.224,5.856 -2.976,2.496 -8.064,3.936 -4.992,1.44 -12.576,1.44 H 96.2355 V 51.928 h 56.832 q 2.208,0 3.84,-0.864 1.728,-0.96 1.728,-3.456 0,-2.4 -1.728,-3.264 -1.728,-0.864 -3.84,-0.864 h -56.832 l 13.44,-16.704 h 42.528 q 5.76,0 10.368,1.152 4.704,1.056 7.968,3.36 3.36,2.208 5.088,5.568 1.824,3.264 1.824,7.68 0,2.88 -0.768,5.088 -0.768,2.208 -2.016,3.936 -1.152,1.632 -2.784,2.784 -1.536,1.056 -3.168,1.632 z m -52.512,7.68 v 8.832 h 36.576 q 3.264,0 4.704,-1.152 1.44,-1.152 1.44,-3.36 0,-2.112 -1.44,-3.168 -1.44,-1.152 -4.704,-1.152 z" />
</g>
</g>
<g
id="Graphic_37">
<g
style="fill:#ff9300"
id="text857"
transform="translate(209.109,275)"
aria-label="link">
<path
inkscape:connector-curvature="0"
id="path886"
style="font-weight:400;font-size:48px;font-family:Ethnocentric;fill:#ff9300"
d="M 3.024,45 Z M 37.824,36.744 31.392,45 H 3.024 V 12.888 h 9.936 v 23.856 z" />
<path
inkscape:connector-curvature="0"
id="path888"
style="font-weight:400;font-size:48px;font-family:Ethnocentric;fill:#ff9300"
d="m 41.32425,45 z m 9.936,0 h -9.936 V 12.888 h 9.936 z" />
<path
inkscape:connector-curvature="0"
id="path890"
style="font-weight:400;font-size:48px;font-family:Ethnocentric;fill:#ff9300"
d="m 57.34875,45 z m 32.688,0.528 q -0.96,0 -1.92,-0.336 -0.912,-0.288 -2.064,-1.392 l -19.68,-17.664 V 45 h -9.024 V 18.36 q 0,-1.584 0.432,-2.736 0.48,-1.152 1.2,-1.872 0.768,-0.72 1.728,-1.056 1.008,-0.336 2.064,-0.336 0.912,0 1.824,0.336 0.96,0.288 2.16,1.392 l 19.68,17.664 V 12.888 h 9.072 V 39.48 q 0,1.584 -0.48,2.736 -0.432,1.152 -1.2,1.92 -0.72,0.72 -1.728,1.056 -1.008,0.336 -2.064,0.336 z" />
<path
inkscape:connector-curvature="0"
id="path892"
style="font-weight:400;font-size:48px;font-family:Ethnocentric;fill:#ff9300"
d="m 101.36775,45 z m 40.512,0 h -15.024 l -9.696,-8.448 q -2.496,-2.16 -3.84,-3.36 -1.296,-1.2 -2.112,-2.016 0.048,1.104 0.096,2.304 0.048,1.152 0.048,2.304 V 45 h -9.984 V 12.888 h 9.984 v 7.44 q 0,1.488 -0.048,2.928 -0.048,1.44 -0.144,2.688 0.96,-0.864 2.304,-2.112 1.392,-1.296 3.6,-3.12 l 9.264,-7.824 h 14.4 l -12.288,9.216 q -1.584,1.2 -2.832,2.112 -1.2,0.912 -2.16,1.584 -0.96,0.672 -1.776,1.2 -0.768,0.528 -1.536,1.008 1.392,0.96 3.36,2.4 1.968,1.44 5.088,3.984 z" />
</g>
</g>
<g
id="Graphic_36">
<path
inkscape:connector-curvature="0"
d="m 302.0625,336.9375 h 14.5771 v 6.1875 h -14.5771 z"
style="fill:#ffffff"
id="rect860" />
</g>
<g
id="Graphic_35">
<title
id="title863">path6381</title>
<path
inkscape:connector-curvature="0"
id="path865"
stroke-width="3"
stroke-linejoin="round"
stroke-linecap="round"
stroke="#ff9300"
d="M 116.9282,340.3125 H 342.45 c 6.17355,0 11.1782,5.00465 11.1782,11.1782 v 0 c 0,6.17355 -5.00465,11.1782 -11.1782,11.1782 H 116.9282 c -6.17355,0 -11.1782,-5.00465 -11.1782,-11.1782 v 0 c 0,-6.17355 5.00465,-11.1782 11.1782,-11.1782 z" />
</g>
<g
id="Graphic_34">
<path
inkscape:connector-curvature="0"
d="m 99,347.625 h 14.5771 v 6.1875 H 99 Z"
style="fill:#ffffff"
id="rect868" />
</g>
<g
id="Line_33">
<path
inkscape:connector-curvature="0"
d="M 93.9375,350.85641 H 120.375"
style="stroke:#009051;stroke-width:3;stroke-linecap:round;stroke-linejoin:round"
id="line871" />
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -1,10 +1,18 @@
# OBP-Master #
--- ---
### Forked from the HBLink project ###
### FOR SUPPORT, DISCUSSION, GETTING INVOLVED ### ### FOR SUPPORT, DISCUSSION, GETTING INVOLVED ###
Please join the DVSwitch group at groups.io for online forum support, discussion, and to become part of the development team. Please join the DVSwitch group at groups.io for online forum support, discussion, and to become part of the development team.
DVSwitch@groups.io DVSwitch@groups.io
A voluntary registrty for HBlink systems with public access has been created at http://hblink-register.com.es Please consider listing your system if you allow open access.
--- ---
## PROJECT: Open Source HomeBrew Repeater Proctol Client/Master. ## ## PROJECT: Open Source HomeBrew Repeater Proctol Client/Master. ##
@ -13,7 +21,7 @@ DVSwitch@groups.io
**PURPOSE:** Thanks to the work of Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT we have an open protocol for internetworking DMR repeaters. Unfortunately, there's no generic client and/or master stacks. This project is to build an open-source, python-based implementation. You are free to use this software however you want, however we ask that you provide attribution in some public venue (such as project, club, organization web site). This helps us see where the software is in use and track how it is used. **PURPOSE:** Thanks to the work of Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT we have an open protocol for internetworking DMR repeaters. Unfortunately, there's no generic client and/or master stacks. This project is to build an open-source, python-based implementation. You are free to use this software however you want, however we ask that you provide attribution in some public venue (such as project, club, organization web site). This helps us see where the software is in use and track how it is used.
For those who will ask: This is a piece of software that implements an open-source, amateur radio networking protocol. It is not a network. It is not indended to be a network. It is not intended to replace or circumvent a network. People do those things, code doesn't. For those who will ask: This is a piece of software that implements an open-source, amateur radio networking protocol. It is not a network. It is not intended to be a network. It is not intended to replace or circumvent a network. People do those things, code doesn't.
**PROPERTY:** **PROPERTY:**
This work represents the author's interpretation of the HomeBrew Repeater Protocol, based on the 2015-07-26 documents from DMRplus, "IPSC Protocol Specs for homebrew DMR repeater" as written by Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT, also licenced under Creative Commons BY-NC-SA license. This work represents the author's interpretation of the HomeBrew Repeater Protocol, based on the 2015-07-26 documents from DMRplus, "IPSC Protocol Specs for homebrew DMR repeater" as written by Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT, also licenced under Creative Commons BY-NC-SA license.
@ -54,7 +62,7 @@ chown 65000 /var/log/hblink.log
***0x49 DE N0MJS*** ***0x49 DE N0MJS***
Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS n0mjs@me.com Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS n0mjs@me.com
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

View File

@ -1,150 +0,0 @@
#!/usr/bin/env python
#
###############################################################################
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
###############################################################################
# Python modules we need
import sys
from bitarray import bitarray
from time import time
from importlib import import_module
# Twisted is pretty important, so I keep it separate
from twisted.internet.protocol import Factory, Protocol
from twisted.protocols.basic import NetstringReceiver
from twisted.internet import reactor, task
# Things we import from the main hblink module
from hblink import HBSYSTEM, OPENBRIDGE, systems, hblink_handler, reportFactory, REPORT_OPCODES, mk_aliases
from dmr_utils3.utils import bytes_3, int_id, get_alias
from dmr_utils3 import decode, bptc, const
import config
import log
from const import *
# Stuff for socket reporting
import pickle
# REMOVE LATER from datetime import datetime
# The module needs logging, but handlers, etc. are controlled by the parent
import logging
logger = logging.getLogger(__name__)
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
__author__ = 'Cortney T. Buffington, N0MJS'
__copyright__ = 'Copyright (c) 2016-2018 Cortney T. Buffington, N0MJS and the K0USY Group'
__credits__ = 'Colin Durbridge, G4EML, Steve Zingman, N4IRS; Mike Zingman, N4IRR; Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT'
__license__ = 'GNU GPLv3'
__maintainer__ = 'Cort Buffington, N0MJS'
__email__ = 'n0mjs@me.com'
# Module gobal varaibles
class OBP(OPENBRIDGE):
def __init__(self, _name, _config, _report):
OPENBRIDGE.__init__(self, _name, _config, _report)
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
pass
class HBP(HBSYSTEM):
def __init__(self, _name, _config, _report):
HBSYSTEM.__init__(self, _name, _config, _report)
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
pass
#************************************************
# MAIN PROGRAM LOOP STARTS HERE
#************************************************
if __name__ == '__main__':
import argparse
import sys
import os
import signal
# Change the current directory to the location of the application
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually hblink.cfg)')
parser.add_argument('-l', '--logging', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
cli_args = parser.parse_args()
# Ensure we have a path for the config file, if one wasn't specified, then use the default (top of file)
if not cli_args.CONFIG_FILE:
cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg'
# Call the external routine to build the configuration dictionary
CONFIG = config.build_config(cli_args.CONFIG_FILE)
# Start the system logger
if cli_args.LOG_LEVEL:
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
logger = log.config_logging(CONFIG['LOGGER'])
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018\n\tThe Regents of the K0USY Group. All rights reserved.\n')
logger.debug('(GLOBAL) Logging system started, anything from here on gets logged')
# Set up the signal handler
def sig_handler(_signal, _frame):
logger.info('(GLOBAL) SHUTDOWN: CONFBRIDGE IS TERMINATING WITH SIGNAL %s', str(_signal))
hblink_handler(_signal, _frame)
logger.info('(GLOBAL) SHUTDOWN: ALL SYSTEM HANDLERS EXECUTED - STOPPING REACTOR')
reactor.stop()
# Set signal handers so that we can gracefully exit if need be
for sig in [signal.SIGINT, signal.SIGTERM]:
signal.signal(sig, sig_handler)
# Create the name-number mapping dictionaries
peer_ids, subscriber_ids, talkgroup_ids = mk_aliases(CONFIG)
# INITIALIZE THE REPORTING LOOP
if CONFIG['REPORTS']['REPORT']:
report_server = config_reports(CONFIG, bridgeReportFactory)
else:
report_server = None
logger.info('(REPORT) TCP Socket reporting not configured')
# HBlink instance creation
logger.info('(GLOBAL) HBlink \'bridge.py\' -- SYSTEM STARTING...')
for system in CONFIG['SYSTEMS']:
if CONFIG['SYSTEMS'][system]['ENABLED']:
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
systems[system] = OBP(system, CONFIG, report_server)
else:
systems[system] = HBP(system, CONFIG, report_server)
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
logger.debug('(GLOBAL) %s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
def loopingErrHandle(failure):
logger.error('(GLOBAL) STOPPING REACTOR TO AVOID MEMORY LEAK: Unhandled error in timed loop.\n %s', failure)
reactor.stop()
reactor.run()

1090
bridge.py

File diff suppressed because it is too large Load Diff

295
bridge_all.py Executable file
View File

@ -0,0 +1,295 @@
#!/usr/bin/env python
#
###############################################################################
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
###############################################################################
'''
This is a very simple call/packet router for Homebrew Repeater Protocol. It
will forward traffic from any system to all other systems configured in the
hblink.py configuration file. It does not check for call contentions or
filter TS/TGID combinations. It should really only be used as a proxy to
hide multiple Homebrew repater protocol systems behind what appears as a single
repeater, hotspot, etc.
As is, this program only works with group voice packets. It could work for all
of them by removing a few things.
IT ONLY WORKS FOR HBP SYSTEMS!!! Using it with OpenBridge or XLX wouldn't make
a lot of sense, and has the potential to do bad things.
'''
# Python modules we need
import sys
from bitarray import bitarray
from time import time
from importlib import import_module
from types import ModuleType
# Twisted is pretty important, so I keep it separate
from twisted.internet.protocol import Factory, Protocol
from twisted.protocols.basic import NetstringReceiver
from twisted.internet import reactor, task
# Things we import from the main hblink module
from hblink import HBSYSTEM, OPENBRIDGE, systems, hblink_handler, reportFactory, REPORT_OPCODES, config_reports, mk_aliases, acl_check
from dmr_utils3.utils import bytes_3, int_id, get_alias
from dmr_utils3 import decode, bptc, const
import config
import log
import const
# The module needs logging logging, but handlers, etc. are controlled by the parent
import logging
logger = logging.getLogger(__name__)
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
__author__ = 'Cortney T. Buffington, N0MJS'
__copyright__ = 'Copyright (c) 2016-2018 Cortney T. Buffington, N0MJS and the K0USY Group'
__credits__ = 'Colin Durbridge, G4EML, Steve Zingman, N4IRS; Mike Zingman, N4IRR; Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT'
__license__ = 'GNU GPLv3'
__maintainer__ = 'Cort Buffington, N0MJS'
__email__ = 'n0mjs@me.com'
__status__ = 'pre-alpha'
# Module gobal varaibles
class bridgeallSYSTEM(HBSYSTEM):
def __init__(self, _name, _config, _report):
HBSYSTEM.__init__(self, _name, _config, _report)
self._laststrid = ''
# Status information for the system, TS1 & TS2
# 1 & 2 are "timeslot"
self.STATUS = {
1: {
'RX_START': time(),
'RX_LOSS': 0,
'RX_SEQ': 0,
'RX_RFS': b'\x00',
'TX_RFS': b'\x00',
'RX_STREAM_ID': b'\x00',
'TX_STREAM_ID': b'\x00',
'RX_TGID': b'\x00\x00\x00',
'TX_TGID': b'\x00\x00\x00',
'RX_TIME': time(),
'TX_TIME': time(),
'RX_TYPE': const.HBPF_SLT_VTERM,
},
2: {
'RX_START': time(),
'RX:LOSS': 0,
'RX_SEQ': 0,
'RX_RFS': b'\x00',
'TX_RFS': b'\x00',
'RX_STREAM_ID': b'\x00',
'TX_STREAM_ID': b'\x00',
'RX_TGID': b'\x00\x00\x00',
'TX_TGID': b'\x00\x00\x00',
'RX_TIME': time(),
'TX_TIME': time(),
'RX_TYPE': const.HBPF_SLT_VTERM,
}
}
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
pkt_time = time()
dmrpkt = _data[20:53]
_bits = _data[15]
if _call_type == 'group':
# Is this is a new call stream?
new_stream = (_stream_id != self.STATUS[_slot]['RX_STREAM_ID'])
if new_stream:
self.STATUS[_slot]['RX_START'] = pkt_time
self.STATUS[_slot]['RX_LOSS'] = 0
self.STATUS[_slot]['RX_SEQ'] = _seq
logger.info('(%s) *CALL START* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s', \
self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot)
else:
# This could be much better, it will have errors during roll-over
if _seq > (self.STATUS[_slot]['RX_SEQ'] + 1):
#print(_seq, self.STATUS[_slot]['RX_SEQ'])
self.STATUS[_slot]['RX_LOSS'] += _seq - (self.STATUS[_slot]['RX_SEQ'] + 1)
# Final actions - Is this a voice terminator?
if (_frame_type == const.HBPF_DATA_SYNC) and (_dtype_vseq == const.HBPF_SLT_VTERM) and (self.STATUS[_slot]['RX_TYPE'] != const.HBPF_SLT_VTERM):
call_duration = pkt_time - self.STATUS[_slot]['RX_START']
logger.info('(%s) *CALL END* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s, Loss: %s, Duration: %s', \
self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot, self.STATUS[_slot]['RX_LOSS'], call_duration)
for _target in self._CONFIG['SYSTEMS']:
if _target != self._system:
_target_status = systems[_target].STATUS
_target_system = self._CONFIG['SYSTEMS'][_target]
# BEGIN STANDARD CONTENTION HANDLING
#
# The rules for each of the 4 "ifs" below are listed here for readability. The Frame To Send is:
# From a different group than last RX from this HBSystem, but it has been less than Group Hangtime
# From a different group than last TX to this HBSystem, but it has been less than Group Hangtime
# From the same group as the last RX from this HBSystem, but from a different subscriber, and it has been less than stream timeout
# From the same group as the last TX to this HBSystem, but from a different subscriber, and it has been less than stream timeout
# The "continue" at the end of each means the next iteration of the for loop that tests for matching rules
#
if ((_dst_id != _target_status[_slot]['RX_TGID']) and ((pkt_time - _target_status[_slot]['RX_TIME']) < _target_system['GROUP_HANGTIME'])):
if _frame_type == const.HBPF_DATA_SYNC and _dtype_vseq == const.HBPF_SLT_VHEAD and self.STATUS[_slot]['RX_STREAM_ID'] != _stream_id:
logger.info('(%s) Call not routed to TGID %s, target active or in group hangtime: HBSystem: %s, TS: %s, TGID: %s', self._system, int_id(_dst_id), _target, _slot, int_id(_target_status[_slot]['RX_TGID']))
continue
if ((_dst_id != _target_status[_slot]['TX_TGID']) and ((pkt_time - _target_status[_slot]['TX_TIME']) < _target_system['GROUP_HANGTIME'])):
if _frame_type == const.HBPF_DATA_SYNC and _dtype_vseq == const.HBPF_SLT_VHEAD and self.STATUS[_slot]['RX_STREAM_ID'] != _stream_id:
logger.info('(%s) Call not routed to TGID%s, target in group hangtime: HBSystem: %s, TS: %s, TGID: %s', self._system, int_id(_dst_id), _target, _slot, int_id(_target_status[_slot]['TX_TGID']))
continue
if (_dst_id == _target_status[_slot]['RX_TGID']) and ((pkt_time - _target_status[_slot]['RX_TIME']) < const.STREAM_TO):
if _frame_type == const.HBPF_DATA_SYNC and _dtype_vseq == const.HBPF_SLT_VHEAD and self.STATUS[_slot]['RX_STREAM_ID'] != _stream_id:
logger.info('(%s) Call not routed to TGID%s, matching call already active on target: HBSystem: %s, TS: %s, TGID: %s', self._system, int_id(_dst_id), _target, _slot, int_id(_target_status[_slot]['RX_TGID']))
continue
if (_dst_id == _target_status[_slot]['TX_TGID']) and (_rf_src != _target_status[_slot]['TX_RFS']) and ((pkt_time - _target_status[_slot]['TX_TIME']) < const.STREAM_TO):
if _frame_type == const.HBPF_DATA_SYNC and _dtype_vseq == const.HBPF_SLT_VHEAD and self.STATUS[_slot]['RX_STREAM_ID'] != _stream_id:
logger.info('(%s) Call not routed for subscriber %s, call route in progress on target: HBSystem: %s, TS: %s, TGID: %s, SUB: %s', self._system, int_id(_rf_src), _target, _slot, int_id(_target_status[_slot]['TX_TGID']), int_id(_target_status[_slot]['TX_RFS']))
continue
# ACL Processing
if self._CONFIG['GLOBAL']['USE_ACL']:
if not acl_check(_rf_src, self._CONFIG['GLOBAL']['SUB_ACL']):
if _stream_id != _target_status[_slot]['TX_STREAM_ID']:
logger.info('(%s) CALL DROPPED ON EGRESS WITH STREAM ID %s FROM SUBSCRIBER %s BY GLOBAL ACL', _target, int_id(_stream_id), int_id(_rf_src))
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
continue
if _slot == 1 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG1_ACL']):
if _stream_id != _target_status[_slot]['TX_STREAM_ID']:
logger.info('(%s) CALL DROPPED ON EGRESS WITH STREAM ID %s ON TGID %s BY GLOBAL TS1 ACL', _target, int_id(_stream_id), int_id(_dst_id))
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
continue
if _slot == 2 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG2_ACL']):
if _stream_id != _target_status[_slot]['TX_STREAM_ID']:
logger.info('(%s) CALL DROPPED ON EGRESS WITH STREAM ID %s ON TGID %s BY GLOBAL TS2 ACL', _target, int_id(_stream_id), int_id(_dst_id))
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
continue
if _target_system['USE_ACL']:
if not acl_check(_rf_src, _target_system['SUB_ACL']):
if _stream_id != _target_status[_slot]['TX_STREAM_ID']:
logger.info('(%s) CALL DROPPED ON EGRESS WITH STREAM ID %s FROM SUBSCRIBER %s BY SYSTEM ACL', _target, int_id(_stream_id), int_id(_rf_src))
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
continue
if _slot == 1 and not acl_check(_dst_id, _target_system['TG1_ACL']):
if _stream_id != _target_status[_slot]['TX_STREAM_ID']:
logger.info('(%s) CALL DROPPED ON EGRESS WITH STREAM ID %s ON TGID %s BY SYSTEM TS1 ACL', _target, int_id(_stream_id), int_id(_dst_id))
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
continue
if _slot == 2 and not acl_check(_dst_id, _target_system['TG2_ACL']):
if _stream_id != _target_status[_slot]['TX_STREAM_ID']:
logger.info('(%s) CALL DROPPED ON EGRESS WITH STREAM ID %s ON TGID %s BY SYSTEM TS2 ACL', _target, int_id(_stream_id), int_id(_dst_id))
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
continue
# Record this stuff for later
# Is this a new call stream?
if new_stream:
# Record the DST TGID and Stream ID
_target_status[_slot]['TX_START'] = pkt_time
_target_status[_slot]['TX_TGID'] = _dst_id
_target_status[_slot]['TX_RFS'] = _rf_src
_target_status[_slot]['TX_PEER'] = _peer_id
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
_target_status[_slot]['TX_TIME'] = pkt_time
systems[_target].send_system(_data)
#logger.debug('(%s) Packet routed to system: %s', self._system, _target)
# Mark status variables for use later
self.STATUS[_slot]['RX_RFS'] = _rf_src
self.STATUS[_slot]['RX_SEQ'] = _seq
self.STATUS[_slot]['RX_TYPE'] = _dtype_vseq
self.STATUS[_slot]['RX_TGID'] = _dst_id
self.STATUS[_slot]['RX_TIME'] = pkt_time
self.STATUS[_slot]['RX_STREAM_ID'] = _stream_id
#************************************************
# MAIN PROGRAM LOOP STARTS HERE
#************************************************
if __name__ == '__main__':
import argparse
import sys
import os
import signal
from dmr_utils3.utils import try_download, mk_id_dict
# Change the current directory to the location of the application
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually hblink.cfg)')
parser.add_argument('-l', '--logging', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
cli_args = parser.parse_args()
# Ensure we have a path for the config file, if one wasn't specified, then use the default (top of file)
if not cli_args.CONFIG_FILE:
cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg'
# Call the external routine to build the configuration dictionary
CONFIG = config.build_config(cli_args.CONFIG_FILE)
# Start the system logger
if cli_args.LOG_LEVEL:
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
logger = log.config_logging(CONFIG['LOGGER'])
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018, 2019\n\tThe Regents of the K0USY Group. All rights reserved.\n')
logger.debug('Logging system started, anything from here on gets logged')
# Set up the signal handler
def sig_handler(_signal, _frame):
logger.info('SHUTDOWN: BRIDGE_ALL IS TERMINATING WITH SIGNAL %s', str(_signal))
hblink_handler(_signal, _frame)
logger.info('SHUTDOWN: ALL SYSTEM HANDLERS EXECUTED - STOPPING REACTOR')
reactor.stop()
# Set signal handers so that we can gracefully exit if need be
for sig in [signal.SIGTERM, signal.SIGINT]:
signal.signal(sig, sig_handler)
# Create the name-number mapping dictionaries
peer_ids, subscriber_ids, talkgroup_ids = mk_aliases(CONFIG)
# INITIALIZE THE REPORTING LOOP
report_server = config_reports(CONFIG, reportFactory)
# HBlink instance creation
logger.info('HBlink \'bridge_all.py\' -- SYSTEM STARTING...')
for system in CONFIG['SYSTEMS']:
if CONFIG['SYSTEMS'][system]['ENABLED']:
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
logger.critical('%s FATAL: Instance is mode \'OPENBRIDGE\', \n\t\t...Which would be tragic for Bridge All, since it carries multiple call\n\t\tstreams simultaneously. bridge_all.py onlyl works with MMDVM-based systems', system)
sys.exit('bridge_all.py cannot function with systems that are not MMDVM devices. System {} is configured as an OPENBRIDGE'.format(system))
else:
systems[system] = bridgeallSYSTEM(system, CONFIG, report_server)
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
logger.debug('%s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
reactor.run()

View File

@ -86,7 +86,7 @@ def acl_build(_acl, _max):
if (const.ID_MIN <= start <= _max) or (const.ID_MIN <= end <= _max): if (const.ID_MIN <= start <= _max) or (const.ID_MIN <= end <= _max):
acl.append((start, end)) acl.append((start, end))
else: else:
sys.exit('ACL CREATION ERROR, VALUE OUT OF RANGE (} - {})IN RANGE-BASED ENTRY: {}'.format(const.ID_MIN, _max, entry)) sys.exit('ACL CREATION ERROR, VALUE OUT OF RANGE ({} - {})IN RANGE-BASED ENTRY: {}'.format(const.ID_MIN, _max, entry))
else: else:
id = int(entry) id = int(entry)
if (const.ID_MIN <= id <= _max): if (const.ID_MIN <= id <= _max):
@ -182,7 +182,7 @@ def build_config(_config_file):
'SOFTWARE_ID': bytes(config.get(section, 'SOFTWARE_ID').ljust(40)[:40], 'utf-8'), 'SOFTWARE_ID': bytes(config.get(section, 'SOFTWARE_ID').ljust(40)[:40], 'utf-8'),
'PACKAGE_ID': bytes(config.get(section, 'PACKAGE_ID').ljust(40)[:40], 'utf-8'), 'PACKAGE_ID': bytes(config.get(section, 'PACKAGE_ID').ljust(40)[:40], 'utf-8'),
'GROUP_HANGTIME': config.getint(section, 'GROUP_HANGTIME'), 'GROUP_HANGTIME': config.getint(section, 'GROUP_HANGTIME'),
'OPTIONS': bytes(config.get(section, 'OPTIONS'), 'utf-8'), 'OPTIONS': b''.join([b'Type=HBlink;', bytes(config.get(section, 'OPTIONS'), 'utf-8')]),
'USE_ACL': config.getboolean(section, 'USE_ACL'), 'USE_ACL': config.getboolean(section, 'USE_ACL'),
'SUB_ACL': config.get(section, 'SUB_ACL'), 'SUB_ACL': config.get(section, 'SUB_ACL'),
'TG1_ACL': config.get(section, 'TGID_TS1_ACL'), 'TG1_ACL': config.get(section, 'TGID_TS1_ACL'),
@ -274,6 +274,7 @@ def build_config(_config_file):
'TARGET_SOCK': (gethostbyname(config.get(section, 'TARGET_IP')), config.getint(section, 'TARGET_PORT')), 'TARGET_SOCK': (gethostbyname(config.get(section, 'TARGET_IP')), config.getint(section, 'TARGET_PORT')),
'TARGET_IP': gethostbyname(config.get(section, 'TARGET_IP')), 'TARGET_IP': gethostbyname(config.get(section, 'TARGET_IP')),
'TARGET_PORT': config.getint(section, 'TARGET_PORT'), 'TARGET_PORT': config.getint(section, 'TARGET_PORT'),
'BOTH_SLOTS': config.getboolean(section, 'BOTH_SLOTS'),
'USE_ACL': config.getboolean(section, 'USE_ACL'), 'USE_ACL': config.getboolean(section, 'USE_ACL'),
'SUB_ACL': config.get(section, 'SUB_ACL'), 'SUB_ACL': config.get(section, 'SUB_ACL'),
'TG1_ACL': config.get(section, 'TGID_ACL'), 'TG1_ACL': config.get(section, 'TGID_ACL'),

View File

@ -50,6 +50,7 @@ HBPF_SLT_VHEAD = 0x1
HBPF_SLT_VTERM = 0x2 HBPF_SLT_VTERM = 0x2
# HomeBrew Protocol Commands # HomeBrew Protocol Commands
DMRA = b'DMRA'
DMRD = b'DMRD' DMRD = b'DMRD'
MSTCL = b'MSTCL' MSTCL = b'MSTCL'
MSTNAK = b'MSTNAK' MSTNAK = b'MSTNAK'

View File

@ -1,195 +0,0 @@
#!/usr/bin/env python
#
###############################################################################
# Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS <n0mjs@me.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
###############################################################################
'''
This tool listens to network traffic and breaks apart HBP and DMR packets.
It is a development and debugging tool and has no purpose in actual production
DMR networking systems.
'''
# Python modules we need
from binascii import b2a_hex as bhex
from bitarray import bitarray
# Twisted is pretty important, so I keep it separate
from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor
# Things we import from the main hblink module
from hblink import HBSYSTEM, systems, hblink_handler
from dmr_utils3.utils import bytes_3, bytes_4, int_id
from dmr_utils3 import bptc
import config
import log
from const import *
# REMOVE LATER from datetime import datetime
# The module needs logging, but handlers, etc. are controlled by the parent
import logging
logger = logging.getLogger(__name__)
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
__author__ = 'Cortney T. Buffington, N0MJS'
__copyright__ = 'Copyright (c) 2016-2019 Cortney T. Buffington, N0MJS and the K0USY Group'
__license__ = 'GNU GPLv3'
__maintainer__ = 'Cort Buffington, N0MJS'
__email__ = 'n0mjs@me.com'
DUMP_HBP = False
DUMP_DMR = True
# Module gobal varaibles
class HBP(HBSYSTEM):
def __init__(self, _name, _config, _report):
HBSYSTEM.__init__(self, _name, _config, _report)
self.last_stream = b'\x00\x00\x00\x00'
self.lcfrags = 0
self.lostcount = 0
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
pktype = 'UNIDENTIFIED'
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM):
pktype = 'VTERM '
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VHEAD):
pktype = 'VHEAD '
if (_frame_type == HBPF_VOICE_SYNC):
pktype = 'VOICE SYNC ' + str(_dtype_vseq + 1)
if (_frame_type == HBPF_VOICE):
pktype = 'VOICE ' + str(_dtype_vseq + 1)
if DUMP_HBP:
print('STREAM: {} SEQ: {} PEER: {} SRC: {} DST: {} SLOT: {} CALL: {} FRAME: {} DTYPE: {}'.format(
int_id(_stream_id), int_id(_seq), int_id(_peer_id), int_id(_rf_src), int_id(_dst_id), _slot, pktype, _frame_type, _dtype_vseq
))
if DUMP_DMR:
payload = _data[20:53]
bitload = bitarray(endian='big')
bitload.frombytes(payload)
if pktype == ('VHEAD '):
LC = bptc.decode_full_lc(bitload[:98] + bitload[-98:]).tobytes()
OPT = bhex(LC[0:3])
DST = int_id(LC[3:6])
SRC = int_id(LC[6:9])
ST = bin(int.from_bytes((bitload[98:109] + bitload[-108:-99])[:8].tobytes(), 'big'))
SC = bhex(bitload[108:-108].tobytes())
print('VOICE HEADER: LC:(OPTIONS: {} DEST: {} SOURCE: {}) -- SLOT TYPE: {} -- SYNC: {}'.format(OPT, DST, SRC, ST, SC))
elif pktype == ('VTERM '):
LC = bptc.decode_full_lc(bitload[:98] + bitload[-98:]).tobytes()
OPT = bhex(LC[0:3])
DST = int_id(LC[3:6])
SRC = int_id(LC[6:9])
ST = bin(int.from_bytes((bitload[98:109] + bitload[-108:-99])[:8].tobytes(), 'big'))
SC = bhex(bitload[108:-108].tobytes())
print('VOICE TERMINATOR: LC:(OPTIONS: {} DEST: {} SOURCE: {}) -- SLOT TYPE: {} -- SYNC: {}'.format(OPT, DST, SRC, ST, SC))
elif pktype == ('VOICE SYNC 1'):
self.lcfrags=0
print('Voice Burst A')
BVC = bitload[0:108] + bitload[-108:]
BSC = bitload[108:-108]
self.lcfrags = 0
elif 'VOICE ' in pktype:
print('Voice Burst B-F')
BVC = bitload[0:108] + bitload[-108:]
BEB = bitload[108:116] + bitload[-116:-108]
BES = bitload[116:-116]
print(len(BVC), len(BEB), len(BES))
#************************************************
# MAIN PROGRAM LOOP STARTS HERE
#************************************************
if __name__ == '__main__':
import argparse
import sys
import os
import signal
# Change the current directory to the location of the application
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually deconstructor.cfg)')
parser.add_argument('-l', '--logging', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
cli_args = parser.parse_args()
# Ensure we have a path for the config file, if one wasn't specified, then use the default (top of file)
if not cli_args.CONFIG_FILE:
cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg'
# Call the external routine to build the configuration dictionary
CONFIG = config.build_config(cli_args.CONFIG_FILE)
# Start the system logger
if cli_args.LOG_LEVEL:
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
logger = log.config_logging(CONFIG['LOGGER'])
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018, 2019\n\tThe Regents of the K0USY Group. All rights reserved.\n')
logger.debug('(GLOBAL) Logging system started, anything from here on gets logged')
# Set up the signal handler
def sig_handler(_signal, _frame):
logger.info('(GLOBAL) SHUTDOWN: DECONSTRUCTOR IS TERMINATING WITH SIGNAL %s', str(_signal))
hblink_handler(_signal, _frame)
logger.info('(GLOBAL) SHUTDOWN: ALL SYSTEM HANDLERS EXECUTED - STOPPING REACTOR')
reactor.stop()
# Set signal handers so that we can gracefully exit if need be
for sig in [signal.SIGINT, signal.SIGTERM]:
signal.signal(sig, sig_handler)
# INITIALIZE THE REPORTING LOOP
report_server = None
# HBlink instance creation
logger.info('(GLOBAL) HBlink \'hbp_deconstructor.py\' -- SYSTEM STARTING...')
for system in CONFIG['SYSTEMS']:
if CONFIG['SYSTEMS'][system]['ENABLED']:
if CONFIG['SYSTEMS'][system]['MODE'] == 'MASTER' or CONFIG['SYSTEMS'][system]['MODE'] == 'PEER':
systems[system] = HBP(system, CONFIG, report_server)
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
logger.debug('(GLOBAL) %s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
def loopingErrHandle(failure):
logger.error('(GLOBAL) STOPPING REACTOR TO AVOID MEMORY LEAK: Unhandled error in timed loop.\n %s', failure)
reactor.stop()
reactor.run()

View File

@ -1,10 +0,0 @@
#!/bin/sh
mkdir -p /var/tmp/config
cd /var/tmp/config
git clone https://${GIT_USER}:${GIT_PASSWORD}@${GIT_REPO}
DIR=$(echo ${GIT_REPO}| sed s/.git$//g | sed s#^.*/##g)
cp -a /var/tmp/config/${DIR}/*cfg /opt/hblink3/
python /opt/hblink3/hblink.py

View File

@ -1,188 +0,0 @@
#!/usr/bin/env python
#
###############################################################################
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
###############################################################################
'''
This module is used to extract the AMBE72, FEC encoded data needed to make DMR
frames. It prints out a list of lists, the outer list contains the word and each
of the inner lists has two elements that comprise the 3 AMBE frames sent in each
DMR packet. The frames are split into 1.5 frames and 1.5 frames, that is to say
the two 108 bit segments used in DMR bursts.
This program is intended to produce the data needed to build words (or phrases)
that can be used to populate the voice_lib.py file. It does not write the file
for you, you must copy the output and paste them into the file. Most of the
formatting, but not all, is done for you.
It will not process OpenBridge systems, and it is strongly recommended you only
use it with one system in the hblink.cfg file at a time -- otherwise things can
get really out of hand quickly.
This is a program for ADVANCED USERS ONLY. I really mean it this time, if you're
not comfortable with how DMR packets are structured and basic Python, this isn't
going to work well for you.
'''
# Python modules we need
from bitarray import bitarray
# Twisted is pretty important, so I keep it separate
from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor
# Things we import from the main hblink module
from hblink import HBSYSTEM, systems, hblink_handler
from dmr_utils3.utils import int_id
import config
import log
# The module needs logging, but handlers, etc. are controlled by the parent
import logging
logger = logging.getLogger(__name__)
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
__author__ = 'Cortney T. Buffington, N0MJS'
__copyright__ = 'Copyright (c) 2016-2019 Cortney T. Buffington, N0MJS and the K0USY Group'
__credits__ = 'Colin Durbridge, G4EML, Steve Zingman, N4IRS; Mike Zingman, N4IRR; Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT'
__license__ = 'GNU GPLv3'
__maintainer__ = 'Cort Buffington, N0MJS'
__email__ = 'n0mjs@me.com'
# Module gobal varaibles
# Precalculated "dmrbits" (DMRD packet byte 15) -- just (slot << 7 | this value) and you're good to go!
HEADBITS = 0b00100001
BURSTBITS = [0b00010000,0b00000001,0b00000010,0b00000011,0b00000100,0b00000101]
TERMBITS = 0b00100010
class HBP(HBSYSTEM):
def __init__(self, _name, _config, _report):
HBSYSTEM.__init__(self, _name, _config, _report)
self.current_stream = '\x00'
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
dmr = _data[20:53]
bits = _data[15] & ~(1<<7)
dmrraw = bitarray(endian='big')
dmrraw.frombytes(dmr)
if bits == HEADBITS:
if self.current_stream != _stream_id:
print('START STREAM ID {} ON SLOT {} FROM SUBSCRIBER {} TO GROUP {}'.format(int_id(_stream_id), _slot, int_id(_rf_src), int_id(_dst_id)))
print('[')
self.current_stream = _stream_id
if bits == TERMBITS:
if self.current_stream == _stream_id:
print(' ]')
print('STOP STREAM ID {}'.format(int_id(_stream_id)))
self.current_stream = '\x00'
if bits == BURSTBITS[0]:
bts = 'Burst A'
sig = [dmrraw[:108], dmrraw[-108:]]
print(' {},'.format(sig))
if bits == BURSTBITS[1]:
bts = 'Burst B'
sig = [dmrraw[:108], dmrraw[-108:]]
print(' {},'.format(sig))
if bits == BURSTBITS[2]:
bts = 'Burst C'
sig = [dmrraw[:108], dmrraw[-108:]]
print(' {},'.format(sig))
if bits == BURSTBITS[3]:
bts = 'Burst D'
sig = [dmrraw[:108], dmrraw[-108:]]
print(' {},'.format(sig))
if bits == BURSTBITS[4]:
bts = 'Burst E'
sig = [dmrraw[:108], dmrraw[-108:]]
print(' {},'.format(sig))
if bits == BURSTBITS[5]:
bts = 'Burst F'
sig = [dmrraw[:108], dmrraw[-108:]]
print(' {},'.format(sig))
#************************************************
# MAIN PROGRAM LOOP STARTS HERE
#************************************************
if __name__ == '__main__':
import argparse
import sys
import os
import signal
# Change the current directory to the location of the application
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually hblink.cfg)')
parser.add_argument('-l', '--logging', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
cli_args = parser.parse_args()
# Ensure we have a path for the config file, if one wasn't specified, then use the default (top of file)
if not cli_args.CONFIG_FILE:
cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg'
# Call the external routine to build the configuration dictionary
CONFIG = config.build_config(cli_args.CONFIG_FILE)
# Start the system logger
if cli_args.LOG_LEVEL:
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
logger = log.config_logging(CONFIG['LOGGER'])
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018, 2019\n\tThe Regents of the K0USY Group. All rights reserved.\n')
logger.debug('(GLOBAL) Logging system started, anything from here on gets logged')
# Set up the signal handler
def sig_handler(_signal, _frame):
logger.info('(GLOBAL) SHUTDOWN: CONFBRIDGE IS TERMINATING WITH SIGNAL %s', str(_signal))
hblink_handler(_signal, _frame)
logger.info('(GLOBAL) SHUTDOWN: ALL SYSTEM HANDLERS EXECUTED - STOPPING REACTOR')
reactor.stop()
# Set signal handers so that we can gracefully exit if need be
for sig in [signal.SIGINT, signal.SIGTERM]:
signal.signal(sig, sig_handler)
# INITIALIZE THE REPORTING LOOP
report_server = None
# HBlink instance creation
logger.info('(GLOBAL) HBlink \'bridge.py\' -- SYSTEM STARTING...')
for system in CONFIG['SYSTEMS']:
if CONFIG['SYSTEMS'][system]['ENABLED']:
if CONFIG['SYSTEMS'][system]['MODE'] == 'MASTER' or CONFIG['SYSTEMS'][system]['MODE'] == 'PEER':
systems[system] = HBP(system, CONFIG, report_server)
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
logger.debug('(GLOBAL) %s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
def loopingErrHandle(failure):
logger.error('(GLOBAL) STOPPING REACTOR TO AVOID MEMORY LEAK: Unhandled error in timed loop.\n %s', failure)
reactor.stop()
reactor.run()

View File

@ -120,7 +120,9 @@ STALE_DAYS: 7
# #
# ACLs: # ACLs:
# OpenBridge does not 'register', so registration ACL is meaningless. # OpenBridge does not 'register', so registration ACL is meaningless.
# OpenBridge passes all traffic on TS1, so there is only 1 TGID ACL. # Proper OpenBridge passes all traffic on TS1.
# HBlink can extend OPB to use both slots for unit calls only.
# Setting "BOTH_SLOTS" True ONLY affects unit traffic!
# Otherwise ACLs work as described in the global stanza # Otherwise ACLs work as described in the global stanza
[OBP-1] [OBP-1]
MODE: OPENBRIDGE MODE: OPENBRIDGE
@ -131,6 +133,7 @@ NETWORK_ID: 3129100
PASSPHRASE: password PASSPHRASE: password
TARGET_IP: 1.2.3.4 TARGET_IP: 1.2.3.4
TARGET_PORT: 62035 TARGET_PORT: 62035
BOTH_SLOTS: True
USE_ACL: True USE_ACL: True
SUB_ACL: DENY:1 SUB_ACL: DENY:1
TGID_ACL: PERMIT:ALL TGID_ACL: PERMIT:ALL

View File

@ -160,8 +160,8 @@ class OPENBRIDGE(DatagramProtocol):
_stream_id = _data[16:20] _stream_id = _data[16:20]
#logger.debug('(%s) DMRD - Seqence: %s, RF Source: %s, Destination ID: %s', self._system, int_id(_seq), int_id(_rf_src), int_id(_dst_id)) #logger.debug('(%s) DMRD - Seqence: %s, RF Source: %s, Destination ID: %s', self._system, int_id(_seq), int_id(_rf_src), int_id(_dst_id))
# Sanity check for OpenBridge -- all calls must be on Slot 1 # Sanity check for OpenBridge -- all calls must be on Slot 1 for Brandmeister or DMR+. Other HBlinks can process timeslot on OPB if the flag is set
if _slot != 1: if _slot != 1 and not self._config['BOTH_SLOTS'] and not _call_type == 'unit':
logger.error('(%s) OpenBridge packet discarded because it was not received on slot 1. SID: %s, TGID %s', self._system, int_id(_rf_src), int_id(_dst_id)) logger.error('(%s) OpenBridge packet discarded because it was not received on slot 1. SID: %s, TGID %s', self._system, int_id(_rf_src), int_id(_dst_id))
return return
@ -206,8 +206,7 @@ class HBSYSTEM(DatagramProtocol):
self._system = _name self._system = _name
self._report = _report self._report = _report
self._config = self._CONFIG['SYSTEMS'][self._system] self._config = self._CONFIG['SYSTEMS'][self._system]
self._laststrid1 = '' self._laststrid = {1: b'', 2: b''}
self._laststrid2 = ''
# Define shortcuts and generic function names based on the type of system we are # Define shortcuts and generic function names based on the type of system we are
if self._config['MODE'] == 'MASTER': if self._config['MODE'] == 'MASTER':
@ -353,45 +352,39 @@ class HBSYSTEM(DatagramProtocol):
_frame_type = (_bits & 0x30) >> 4 _frame_type = (_bits & 0x30) >> 4
_dtype_vseq = (_bits & 0xF) # data, 1=voice header, 2=voice terminator; voice, 0=burst A ... 5=burst F _dtype_vseq = (_bits & 0xF) # data, 1=voice header, 2=voice terminator; voice, 0=burst A ... 5=burst F
_stream_id = _data[16:20] _stream_id = _data[16:20]
#logger.debug('(%s) DMRD - Seqence: %s, RF Source: %s, Destination ID: %s', self._system, int_id(_seq), int_id(_rf_src), int_id(_dst_id)) #logger.debug('(%s) DMRD - Seqence: %s, RF Source: %s, Destination ID: %s', self._system, _seq, int_id(_rf_src), int_id(_dst_id))
# ACL Processing # ACL Processing
if self._CONFIG['GLOBAL']['USE_ACL']: if self._CONFIG['GLOBAL']['USE_ACL']:
if not acl_check(_rf_src, self._CONFIG['GLOBAL']['SUB_ACL']): if not acl_check(_rf_src, self._CONFIG['GLOBAL']['SUB_ACL']):
if self._laststrid != _stream_id: if self._laststrid[_slot] != _stream_id:
logger.info('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY GLOBAL ACL', self._system, int_id(_stream_id), int_id(_rf_src)) logger.info('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY GLOBAL ACL', self._system, int_id(_stream_id), int_id(_rf_src))
if _slot == 1: self._laststrid[_slot] = _stream_id
self._laststrid1 = _stream_id
else:
self._laststrid2 = _stream_id
return return
if _slot == 1 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG1_ACL']): if _slot == 1 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG1_ACL']):
if self._laststrid1 != _stream_id: if self._laststrid[_slot] != _stream_id:
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id)) logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
self._laststrid1 = _stream_id self._laststrid[_slot] = _stream_id
return return
if _slot == 2 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG2_ACL']): if _slot == 2 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG2_ACL']):
if self._laststrid2 != _stream_id: if self._laststrid[_slot] != _stream_id:
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS2 ACL', self._system, int_id(_stream_id), int_id(_dst_id)) logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS2 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
self._laststrid2 = _stream_id self._laststrid[_slot] = _stream_id
return return
if self._config['USE_ACL']: if self._config['USE_ACL']:
if not acl_check(_rf_src, self._config['SUB_ACL']): if not acl_check(_rf_src, self._config['SUB_ACL']):
if self._laststrid != _stream_id: if self._laststrid[_slot] != _stream_id:
logger.info('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY SYSTEM ACL', self._system, int_id(_stream_id), int_id(_rf_src)) logger.info('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY SYSTEM ACL', self._system, int_id(_stream_id), int_id(_rf_src))
if _slot == 1: self._laststrid[_slot] = _stream_id
self._laststrid1 = _stream_id
else:
self._laststrid2 = _stream_id
return return
if _slot == 1 and not acl_check(_dst_id, self._config['TG1_ACL']): if _slot == 1 and not acl_check(_dst_id, self._config['TG1_ACL']):
if self._laststrid1 != _stream_id: if self._laststrid[_slot] != _stream_id:
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id)) logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
self._laststrid1 = _stream_id self._laststrid[_slot] = _stream_id
return return
if _slot == 2 and not acl_check(_dst_id, self._config['TG2_ACL']): if _slot == 2 and not acl_check(_dst_id, self._config['TG2_ACL']):
if self._laststrid2 != _stream_id: if self._laststrid[_slot]!= _stream_id:
logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM TS2 ACL', self._system, int_id(_stream_id), int_id(_dst_id)) logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM TS2 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
self._laststrid2 = _stream_id self._laststrid[_slot] = _stream_id
return return
# The basic purpose of a master is to repeat to the peers # The basic purpose of a master is to repeat to the peers
@ -446,7 +439,7 @@ class HBSYSTEM(DatagramProtocol):
logger.info('(%s) Sent Challenge Response to %s for login: %s', self._system, int_id(_peer_id), self._peers[_peer_id]['SALT']) logger.info('(%s) Sent Challenge Response to %s for login: %s', self._system, int_id(_peer_id), self._peers[_peer_id]['SALT'])
else: else:
self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr) self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr)
logger.warning('(%s) Invalid Login from Radio ID: %s Denied by Registation ACL', self._system, int_id(_peer_id)) logger.warning('(%s) Invalid Login from %s Radio ID: %s Denied by Registation ACL', self._system, _sockaddr[0], int_id(_peer_id))
else: else:
self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr) self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr)
logger.warning('(%s) Registration denied from Radio ID: %s Maximum number of peers exceeded', self._system, int_id(_peer_id)) logger.warning('(%s) Registration denied from Radio ID: %s Maximum number of peers exceeded', self._system, int_id(_peer_id))
@ -526,6 +519,18 @@ class HBSYSTEM(DatagramProtocol):
self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr) self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr)
logger.warning('(%s) Ping from Radio ID that is not logged in: %s', self._system, int_id(_peer_id)) logger.warning('(%s) Ping from Radio ID that is not logged in: %s', self._system, int_id(_peer_id))
elif _command == RPTO:
_peer_id = _data[4:8]
if _peer_id in self._peers \
and self._peers[_peer_id]['CONNECTION'] == 'YES' \
and self._peers[_peer_id]['SOCKADDR'] == _sockaddr:
logger.info('(%s) Peer %s (%s) has send options: %s', self._system, self._peers[_peer_id]['CALLSIGN'], int_id(_peer_id), _data[8:])
self.transport.write(b''.join([RPTACK, _peer_id]), _sockaddr)
elif _command == DMRA:
_peer_id = _data[4:8]
logger.info('(%s) Recieved DMR Talker Alias from peer %s, subscriber %s', self._system, self._peers[_peer_id]['CALLSIGN'], int_id(_rf_src))
else: else:
logger.error('(%s) Unrecognized command. Raw HBP PDU: %s', self._system, ahex(_data)) logger.error('(%s) Unrecognized command. Raw HBP PDU: %s', self._system, ahex(_data))
@ -562,41 +567,35 @@ class HBSYSTEM(DatagramProtocol):
# ACL Processing # ACL Processing
if self._CONFIG['GLOBAL']['USE_ACL']: if self._CONFIG['GLOBAL']['USE_ACL']:
if not acl_check(_rf_src, self._CONFIG['GLOBAL']['SUB_ACL']): if not acl_check(_rf_src, self._CONFIG['GLOBAL']['SUB_ACL']):
if self._laststrid != _stream_id: if self._laststrid[_slot] != _stream_id:
logger.debug('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY GLOBAL ACL', self._system, int_id(_stream_id), int_id(_rf_src)) logger.info('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY GLOBAL ACL', self._system, int_id(_stream_id), int_id(_rf_src))
if _slot == 1: self._laststrid[_slot] = _stream_id
self._laststrid1 = _stream_id
else:
self._laststrid2 = _stream_id
return return
if _slot == 1 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG1_ACL']): if _slot == 1 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG1_ACL']):
if self._laststrid1 != _stream_id: if self._laststrid[_slot] != _stream_id:
logger.debug('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id)) logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
self._laststrid1 = _stream_id self._laststrid[_slot] = _stream_id
return return
if _slot == 2 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG2_ACL']): if _slot == 2 and not acl_check(_dst_id, self._CONFIG['GLOBAL']['TG2_ACL']):
if self._laststrid2 != _stream_id: if self._laststrid[_slot] != _stream_id:
logger.debug('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS2 ACL', self._system, int_id(_stream_id), int_id(_dst_id)) logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY GLOBAL TS2 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
self._laststrid2 = _stream_id self._laststrid[_slot] = _stream_id
return return
if self._config['USE_ACL']: if self._config['USE_ACL']:
if not acl_check(_rf_src, self._config['SUB_ACL']): if not acl_check(_rf_src, self._config['SUB_ACL']):
if self._laststrid != _stream_id: if self._laststrid[_slot] != _stream_id:
logger.debug('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY SYSTEM ACL', self._system, int_id(_stream_id), int_id(_rf_src)) logger.info('(%s) CALL DROPPED WITH STREAM ID %s FROM SUBSCRIBER %s BY SYSTEM ACL', self._system, int_id(_stream_id), int_id(_rf_src))
if _slot == 1: self._laststrid[_slot] = _stream_id
self._laststrid1 = _stream_id
else:
self._laststrid2 = _stream_id
return return
if _slot == 1 and not acl_check(_dst_id, self._config['TG1_ACL']): if _slot == 1 and not acl_check(_dst_id, self._config['TG1_ACL']):
if self._laststrid1 != _stream_id: if self._laststrid[_slot] != _stream_id:
logger.debug('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id)) logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM TS1 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
self._laststrid1 = _stream_id self._laststrid[_slot] = _stream_id
return return
if _slot == 2 and not acl_check(_dst_id, self._config['TG2_ACL']): if _slot == 2 and not acl_check(_dst_id, self._config['TG2_ACL']):
if self._laststrid2 != _stream_id: if self._laststrid[_slot] != _stream_id:
logger.debug('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM TS2 ACL', self._system, int_id(_stream_id), int_id(_dst_id)) logger.info('(%s) CALL DROPPED WITH STREAM ID %s ON TGID %s BY SYSTEM TS2 ACL', self._system, int_id(_stream_id), int_id(_dst_id))
self._laststrid2 = _stream_id self._laststrid[_slot] = _stream_id
return return
@ -661,6 +660,7 @@ class HBSYSTEM(DatagramProtocol):
self._stats['CONNECTION'] = 'YES' self._stats['CONNECTION'] = 'YES'
self._stats['CONNECTED'] = time() self._stats['CONNECTED'] = time()
logger.info('(%s) Connection to Master Completed', self._system) logger.info('(%s) Connection to Master Completed', self._system)
# If we are an XLX, send the XLX module request here. # If we are an XLX, send the XLX module request here.
if self._config['MODE'] == 'XLXPEER': if self._config['MODE'] == 'XLXPEER':
self.send_xlxmaster(self._config['RADIO_ID'], int(4000), self._config['MASTER_SOCKADDR']) self.send_xlxmaster(self._config['RADIO_ID'], int(4000), self._config['MASTER_SOCKADDR'])
@ -802,7 +802,7 @@ if __name__ == '__main__':
if cli_args.LOG_LEVEL: if cli_args.LOG_LEVEL:
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
logger = log.config_logging(CONFIG['LOGGER']) logger = log.config_logging(CONFIG['LOGGER'])
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018, 2019\n\tThe Regents of the K0USY Group. All rights reserved.\n') logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018, 2019, 2020\n\tThe Regents of the K0USY Group. All rights reserved.\n')
logger.debug('(GLOBAL) Logging system started, anything from here on gets logged') logger.debug('(GLOBAL) Logging system started, anything from here on gets logged')
# Set up the signal handler # Set up the signal handler

View File

@ -1,6 +0,0 @@
#! /bin/bash
# Install the required support programs
apt-get install python3 python3-pip -y
pip3 install -r requirements.txt

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
############################################################################### ###############################################################################
# Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS <n0mjs@me.com> # Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -21,11 +21,10 @@
from bitarray import bitarray from bitarray import bitarray
from dmr_utils3 import bptc, golay, qr from dmr_utils3 import bptc, golay, qr
from dmr_utils3.utils import bytes_3, bytes_4 from dmr_utils3.utils import bytes_3, bytes_4
from dmr_utils3.const import EMB, SLOT_TYPE, BS_VOICE_SYNC, BS_DATA_SYNC, LC_OPT_G from dmr_utils3.const import EMB, SLOT_TYPE, BS_VOICE_SYNC, BS_DATA_SYNC, LC_OPT
from random import randint from random import randint
from voice_lib import words from voice_lib import words
# Precalculated "dmrbits" (DMRD packet byte 15) -- just (slot << 7 | this value) and you're good to go! # Precalculated "dmrbits" (DMRD packet byte 15) -- just (slot << 7 | this value) and you're good to go!
HEADBITS = 0b00100001 HEADBITS = 0b00100001
BURSTBITS = [0b00010000,0b00000001,0b00000010,0b00000011,0b00000100,0b00000101] BURSTBITS = [0b00010000,0b00000001,0b00000010,0b00000011,0b00000100,0b00000101]
@ -45,7 +44,7 @@ def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase):
# Calculate all of the static components up-front # Calculate all of the static components up-front
STREAM_ID = bytes_4(randint(0x00, 0xFFFFFFFF)) STREAM_ID = bytes_4(randint(0x00, 0xFFFFFFFF))
SDP = _rf_src + _dst_id + _peer SDP = _rf_src + _dst_id + _peer
LC = LC_OPT_G + _dst_id + _rf_src LC = LC_OPT + _dst_id + _rf_src
HEAD_LC = bptc.encode_header_lc(LC) HEAD_LC = bptc.encode_header_lc(LC)
HEAD_LC = [HEAD_LC[:98], HEAD_LC[-98:]] HEAD_LC = [HEAD_LC[:98], HEAD_LC[-98:]]
@ -64,7 +63,6 @@ def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase):
EMBED.append(EMB['BURST_F'][:8] + NULL_EMB_LC + EMB['BURST_F'][-8:]) EMBED.append(EMB['BURST_F'][:8] + NULL_EMB_LC + EMB['BURST_F'][-8:])
#initialize the HBP calls stream sequence to 0 #initialize the HBP calls stream sequence to 0
SEQ = 0 SEQ = 0
@ -79,15 +77,15 @@ def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase):
# Send each burst, six bursts per Superframe rotating through with the proper EMBED value per burst A-F # Send each burst, six bursts per Superframe rotating through with the proper EMBED value per burst A-F
for word in _phrase: for word in _phrase:
for burst in range(0, len(word)): for burst in range(0, len(word)):
pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | BURSTBITS[burst % 6]]) + STREAM_ID + (word[burst][0] + EMBED[burst % 6] + word[burst][1]).tobytes() + TAIL print(burst)
pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | BURSTBITS[burst % 6]]) + STREAM_ID + (word[burst + 0][0] + EMBED[burst % 6] + word[burst + 0][1]).tobytes() + TAIL
SEQ = (SEQ + 1) % 0x100 SEQ = (SEQ + 1) % 0x100
yield pkt yield pkt
# Send 2 Voice Terminator Frames # Send a single Voice Terminator Frame
for i in range(2): pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | TERMBITS]) + STREAM_ID + (TERM_LC[0] + SLOT_TYPE['VOICE_LC_TERM'][:10] + BS_DATA_SYNC + SLOT_TYPE['VOICE_LC_TERM'][-10:] + TERM_LC[1]).tobytes() + TAIL
pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | TERMBITS]) + STREAM_ID + (TERM_LC[0] + SLOT_TYPE['VOICE_LC_TERM'][:10] + BS_DATA_SYNC + SLOT_TYPE['VOICE_LC_TERM'][-10:] + TERM_LC[1]).tobytes() + TAIL SEQ = (SEQ + 1) % 0x100
SEQ = (SEQ + 1) % 0x100 yield pkt
yield pkt
# Return False to indicate we're done. # Return False to indicate we're done.
return False return False
@ -96,7 +94,7 @@ def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase):
if __name__ == '__main__': if __name__ == '__main__':
from time import time from time import time
speech = pkt_gen(bytes_3(3120101), bytes_3(3120), bytes_4(312000), 0, [words['connected']]) speech = pkt_gen(bytes_3(3120101), bytes_3(3120), bytes_4(312000), 0, [words['all_circuits'], words['all_circuits']])
while True: while True:

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
############################################################################### ###############################################################################
# Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS <n0mjs@me.com> # Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -18,43 +18,30 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
############################################################################### ###############################################################################
'''
This is a short program that is intended to be used only to validate voice entries
in the voice_lib.py file. It should only be used for building voice libraries and
only used during development to validate the entires.
It uses a number of hard-coded parameters, like the voice files to play back, the
slot, talkgroup, source, etc. of the originating stream.
It is not for novices to use, and should only be used by those comfortable with
how DMR packets are build and Python. It does not handle OpenBridge systems, only
HBP systems, and it is HIGHLY recommended to only use it against a single system
at a time.
It is a development and debugging tool and has no purpose in actual production
DMR networking systems.
'''
# Python modules we need # Python modules we need
from time import sleep import sys
from bitarray import bitarray
from time import time, sleep
from importlib import import_module
from binascii import b2a_hex as bhex from binascii import b2a_hex as bhex
from threading import Thread
# Twisted is pretty important, so I keep it separate # Twisted is pretty important, so I keep it separate
from twisted.internet.protocol import Factory, Protocol from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor from twisted.protocols.basic import NetstringReceiver
from twisted.internet import reactor, task
# Things we import from the main hblink module # Things we import from the main hblink module
from hblink import HBSYSTEM, systems, hblink_handler from hblink import HBSYSTEM, OPENBRIDGE, systems, hblink_handler, reportFactory, REPORT_OPCODES, mk_aliases
from dmr_utils3.utils import bytes_3, bytes_4, int_id from dmr_utils3.utils import bytes_3, bytes_4, int_id, get_alias
from dmr_utils3 import decode, bptc, const
import config import config
import log import log
from const import * from const import *
from mk_voice import pkt_gen from mk_voice import pkt_gen
from voice_lib import words from voice_lib import words
# Stuff for socket reporting
import pickle
# REMOVE LATER from datetime import datetime # REMOVE LATER from datetime import datetime
# The module needs logging, but handlers, etc. are controlled by the parent # The module needs logging, but handlers, etc. are controlled by the parent
import logging import logging
@ -71,31 +58,41 @@ __email__ = 'n0mjs@me.com'
# Module gobal varaibles # Module gobal varaibles
class OBP(OPENBRIDGE):
def __init__(self, _name, _config, _report):
OPENBRIDGE.__init__(self, _name, _config, _report)
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
pass
class HBP(HBSYSTEM): class HBP(HBSYSTEM):
def __init__(self, _name, _config, _report): def __init__(self, _name, _config, _report):
HBSYSTEM.__init__(self, _name, _config, _report) HBSYSTEM.__init__(self, _name, _config, _report)
self.last_stream = b'\x00' self.last_stream = b'\x00'
def play_voice(self, _rf_src, _tgid, _peer, _slot, _speech):
speech = pkt_gen(_rf_src, _tgid, _peer, _slot, _speech)
sleep(1)
while True:
try:
pkt = next(speech)
except StopIteration:
break
sleep(.058)
self.send_system(pkt)
return None
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data): def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM) and (_stream_id != self.last_stream) and (_dst_id == bytes_3(2)): if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM) and (_stream_id != self.last_stream):
print(int_id(_stream_id), int_id(self.last_stream))
self.last_stream = _stream_id self.last_stream = _stream_id
print('start speech')
speech = pkt_gen(bytes_3(3120101), bytes_3(2), bytes_4(3120119), 0, [words['all_circuits'],words['all_circuits']])
sleep(1)
while True:
try:
pkt = next(speech)
except StopIteration:
break
sleep(.058)
self.send_system(pkt)
print(bhex(pkt))
print('end speech')
feedback = Thread(target=self.play_voice(bytes_3(3120102), bytes_3(2), bytes_4(3120119), 0, [words['connected'], words['kansas_link']]))
feedback.start()
#************************************************ #************************************************
@ -143,14 +140,23 @@ if __name__ == '__main__':
for sig in [signal.SIGINT, signal.SIGTERM]: for sig in [signal.SIGINT, signal.SIGTERM]:
signal.signal(sig, sig_handler) signal.signal(sig, sig_handler)
# Create the name-number mapping dictionaries
peer_ids, subscriber_ids, talkgroup_ids = mk_aliases(CONFIG)
# INITIALIZE THE REPORTING LOOP # INITIALIZE THE REPORTING LOOP
report_server = None if CONFIG['REPORTS']['REPORT']:
report_server = config_reports(CONFIG, bridgeReportFactory)
else:
report_server = None
logger.info('(REPORT) TCP Socket reporting not configured')
# HBlink instance creation # HBlink instance creation
logger.info('(GLOBAL) HBlink \'bridge.py\' -- SYSTEM STARTING...') logger.info('(GLOBAL) HBlink \'bridge.py\' -- SYSTEM STARTING...')
for system in CONFIG['SYSTEMS']: for system in CONFIG['SYSTEMS']:
if CONFIG['SYSTEMS'][system]['ENABLED']: if CONFIG['SYSTEMS'][system]['ENABLED']:
if CONFIG['SYSTEMS'][system]['MODE'] == 'MASTER' or CONFIG['SYSTEMS'][system]['MODE'] == 'PEER': if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
systems[system] = OBP(system, CONFIG, report_server)
else:
systems[system] = HBP(system, CONFIG, report_server) systems[system] = HBP(system, CONFIG, report_server)
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP']) reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
logger.debug('(GLOBAL) %s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system]) logger.debug('(GLOBAL) %s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
@ -159,4 +165,5 @@ if __name__ == '__main__':
logger.error('(GLOBAL) STOPPING REACTOR TO AVOID MEMORY LEAK: Unhandled error in timed loop.\n %s', failure) logger.error('(GLOBAL) STOPPING REACTOR TO AVOID MEMORY LEAK: Unhandled error in timed loop.\n %s', failure)
reactor.stop() reactor.stop()
reactor.run() reactor.run()

229
playback.py Executable file
View File

@ -0,0 +1,229 @@
#!/usr/bin/env python
#
###############################################################################
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com> (and Mike Zingman N4IRR)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
###############################################################################
# Python modules we need
import sys
from bitarray import bitarray
from time import time, sleep
from importlib import import_module
# Twisted is pretty important, so I keep it separate
from twisted.internet.protocol import Factory, Protocol
from twisted.protocols.basic import NetstringReceiver
from twisted.internet import reactor, task
# Things we import from the main hblink module
from hblink import HBSYSTEM, systems, hblink_handler, reportFactory, REPORT_OPCODES, config_reports, mk_aliases
from dmr_utils3.utils import bytes_3, int_id, get_alias
from dmr_utils3 import decode, bptc, const
import config
import log
import const
# The module needs logging logging, but handlers, etc. are controlled by the parent
import logging
logger = logging.getLogger(__name__)
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
__author__ = 'Cortney T. Buffington, N0MJS and Mike Zingman, N4IRR'
__copyright__ = 'Copyright (c) 2016-2019 Cortney T. Buffington, N0MJS and the K0USY Group'
__license__ = 'GNU GPLv3'
__maintainer__ = 'Cort Buffington, N0MJS'
__email__ = 'n0mjs@me.com'
__status__ = 'pre-alpha'
# Module gobal varaibles
class playback(HBSYSTEM):
def __init__(self, _name, _config, _report):
HBSYSTEM.__init__(self, _name, _config, _report)
# Status information for the system, TS1 & TS2
# 1 & 2 are "timeslot"
# In TX_EMB_LC, 2-5 are burst B-E
self.STATUS = {
1: {
'RX_START': time(),
'RX_SEQ': '\x00',
'RX_RFS': '\x00',
'TX_RFS': '\x00',
'RX_STREAM_ID': '\x00',
'TX_STREAM_ID': '\x00',
'RX_TGID': '\x00\x00\x00',
'TX_TGID': '\x00\x00\x00',
'RX_TIME': time(),
'TX_TIME': time(),
'RX_TYPE': const.HBPF_SLT_VTERM,
'RX_LC': '\x00',
'TX_H_LC': '\x00',
'TX_T_LC': '\x00',
'TX_EMB_LC': {
1: '\x00',
2: '\x00',
3: '\x00',
4: '\x00',
}
},
2: {
'RX_START': time(),
'RX_SEQ': '\x00',
'RX_RFS': '\x00',
'TX_RFS': '\x00',
'RX_STREAM_ID': '\x00',
'TX_STREAM_ID': '\x00',
'RX_TGID': '\x00\x00\x00',
'TX_TGID': '\x00\x00\x00',
'RX_TIME': time(),
'TX_TIME': time(),
'RX_TYPE': const.HBPF_SLT_VTERM,
'RX_LC': '\x00',
'TX_H_LC': '\x00',
'TX_T_LC': '\x00',
'TX_EMB_LC': {
1: '\x00',
2: '\x00',
3: '\x00',
4: '\x00',
}
}
}
self.CALL_DATA = []
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
pkt_time = time()
dmrpkt = _data[20:53]
_bits = _data[15]
if _call_type == 'group':
# Is this is a new call stream?
if (_stream_id != self.STATUS[_slot]['RX_STREAM_ID']):
self.STATUS['RX_START'] = pkt_time
logger.info('(%s) *START RECORDING* STREAM ID: %s SUB: %s (%s) REPEATER: %s (%s) TGID %s (%s), TS %s', \
self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot)
self.CALL_DATA.append(_data)
self.STATUS[_slot]['RX_STREAM_ID'] = _stream_id
return
# Final actions - Is this a voice terminator?
if (_frame_type == const.HBPF_DATA_SYNC) and (_dtype_vseq == const.HBPF_SLT_VTERM) and (self.STATUS[_slot]['RX_TYPE'] != const.HBPF_SLT_VTERM) and (self.CALL_DATA):
call_duration = pkt_time - self.STATUS['RX_START']
self.CALL_DATA.append(_data)
logger.info('(%s) *END RECORDING* STREAM ID: %s', self._system, int_id(_stream_id))
sleep(2)
logger.info('(%s) *START PLAYBACK* STREAM ID: %s SUB: %s (%s) REPEATER: %s (%s) TGID %s (%s), TS %s, Duration: %s', \
self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot, call_duration)
for i in self.CALL_DATA:
self.send_system(i)
#print(i)
sleep(0.06)
self.CALL_DATA = []
logger.info('(%s) *END PLAYBACK* STREAM ID: %s', self._system, int_id(_stream_id))
else:
if self.CALL_DATA:
self.CALL_DATA.append(_data)
# Mark status variables for use later
self.STATUS[_slot]['RX_RFS'] = _rf_src
self.STATUS[_slot]['RX_TYPE'] = _dtype_vseq
self.STATUS[_slot]['RX_TGID'] = _dst_id
self.STATUS[_slot]['RX_TIME'] = pkt_time
self.STATUS[_slot]['RX_STREAM_ID'] = _stream_id
#************************************************
# MAIN PROGRAM LOOP STARTS HERE
#************************************************
if __name__ == '__main__':
import argparse
import sys
import os
import signal
from dmr_utils3.utils import try_download, mk_id_dict
# Change the current directory to the location of the application
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
# CLI argument parser - handles picking up the config file from the command line, and sending a "help" message
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually hblink.cfg)')
parser.add_argument('-l', '--logging', action='store', dest='LOG_LEVEL', help='Override config file logging level.')
cli_args = parser.parse_args()
# Ensure we have a path for the config file, if one wasn't specified, then use the default (top of file)
if not cli_args.CONFIG_FILE:
cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg'
# Call the external routine to build the configuration dictionary
CONFIG = config.build_config(cli_args.CONFIG_FILE)
# Start the system logger
if cli_args.LOG_LEVEL:
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
logger = log.config_logging(CONFIG['LOGGER'])
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018, 2019\n\tThe Founding Members of the K0USY Group. All rights reserved.\n')
logger.debug('Logging system started, anything from here on gets logged')
# Set up the signal handler
def sig_handler(_signal, _frame):
logger.info('SHUTDOWN: HBROUTER IS TERMINATING WITH SIGNAL %s', str(_signal))
hblink_handler(_signal, _frame)
logger.info('SHUTDOWN: ALL SYSTEM HANDLERS EXECUTED - STOPPING REACTOR')
reactor.stop()
# Set signal handers so that we can gracefully exit if need be
for sig in [signal.SIGTERM, signal.SIGINT]:
signal.signal(sig, sig_handler)
# ID ALIAS CREATION
# Download
if CONFIG['ALIASES']['TRY_DOWNLOAD'] == True:
# Try updating peer aliases file
result = try_download(CONFIG['ALIASES']['PATH'], CONFIG['ALIASES']['PEER_FILE'], CONFIG['ALIASES']['PEER_URL'], CONFIG['ALIASES']['STALE_TIME'])
logger.info(result)
# Try updating subscriber aliases file
result = try_download(CONFIG['ALIASES']['PATH'], CONFIG['ALIASES']['SUBSCRIBER_FILE'], CONFIG['ALIASES']['SUBSCRIBER_URL'], CONFIG['ALIASES']['STALE_TIME'])
logger.info(result)
# Create the name-number mapping dictionaries
peer_ids, subscriber_ids, talkgroup_ids = mk_aliases(CONFIG)
# INITIALIZE THE REPORTING LOOP
report_server = config_reports(CONFIG, reportFactory)
# HBlink instance creation
logger.info('HBlink \'playback.py\' (c) 2017-2019 Cort Buffington, N0MJS & Mike Zingman, N4IRR -- SYSTEM STARTING...')
for system in CONFIG['SYSTEMS']:
if CONFIG['SYSTEMS'][system]['ENABLED']:
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
logger.critical('%s FATAL: Instance is mode \'OPENBRIDGE\', \n\t\t...Which would be tragic for playback, since it carries multiple call\n\t\tstreams simultaneously. playback.py onlyl works with MMDVM-based systems', system)
sys.exit('playback.py cannot function with systems that are not MMDVM devices. System {} is configured as an OPENBRIDGE'.format(system))
else:
systems[system] = playback(system, CONFIG, report_server)
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
logger.debug('%s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
reactor.run()

View File

@ -47,20 +47,18 @@ BRIDGES = {
] ]
} }
TELEMETRY = { '''
'WORLDWIDE': [ list the names of each system that should bridge unit to unit (individual) calls.
{'SYSTEM': 'MASTER-1', 'ON': [], 'OFF': []} '''
],
'ENGLISH': [ UNIT = ['ONE', 'TWO']
{'SYSTEM': 'MASTER-1', 'ON': [], 'OFF': []},
{'SYSTEM': 'REPEATER-1', 'ON': [], 'OFF': []} '''
], This is for testing the syntax of the file. It won't eliminate all errors, but running this file
'STATEWIDE': [ like it were a Python program itself will tell you if the syntax is correct!
{'SYSTEM': 'MASTER-1', 'ON': [], 'OFF': []}, '''
{'SYSTEM': 'REPEATER-1', 'ON': [], 'OFF': []}
]
}
if __name__ == '__main__': if __name__ == '__main__':
from pprint import pprint from pprint import pprint
pprint(BRIDGES) pprint(BRIDGES)
print(UNIT)

213
voice_lib.py Normal file → Executable file
View File

@ -1,79 +1,146 @@
'''
This is a voice file library that is used by other programs so that
hblink can "talk" and provide voice feedback for users. It does nothing
on it's own, but is called by programs that need to create their own
voice feedback for users -- like to notify of system events, etc.
The format is already HIGHLY processed to make assembly of DMR packets
quick and easy on the fly. DMR voice packets each contain 3 AMBE
frames. They are 72bit FEC encoded and they are combined so that
1.5 of the frames fit on each side of the control information in the
center of the packet.
'''
from bitarray import bitarray from bitarray import bitarray
words = { words = {
'kansas_link': [ 'all_circuits': [
[bitarray('111111101110010010000001000001110111000100000111000111111101010111101011111111011100011110000011001101010011'), bitarray('010100010000010011111000011110001001110010100011100110000010011001100001001001010111100111011100010101010011')], [bitarray('001011000001010000100010001001011111101010110000110001100010011001011000001010010000000100000111010000111101'), bitarray('100101001000101100110100111010010101011010110100001001100010000001111001101000010010000101110010111000101011')],
[bitarray('111110000001101110100011000001010010001000000010110011111111001100100101111011111111010010000011001101110001'), bitarray('010000010000000011001001010111001110111011101100011110100011011100010111010101000001010011001010000110101100')], [bitarray('000010010000010101100110000100000010111101001010001111000010001100111011001111010110010000100100110101000111'), bitarray('001000001000100101100010010100100010001111010110011111000110001100100111000110100100110111100011001010011000')],
[bitarray('111111101101010110100010000101110111000001000111001010111101001011111111111111011100010010000011001100110001'), bitarray('001100110101010110011101001011011000111111111110011010100001010100010011001100110100011011001110000111101111')], [bitarray('111111110010101010101001111000111010110110011010011000001001110011011101001110000011001101111010100001111111'), bitarray('010101101001110001010011011000111111000011000011011100000011011001011011100111110010111001100001000000111111')],
[bitarray('111011101110011010100010000101110001000000000101000010001000011011111010111111011100010110100001011100110101'), bitarray('000001010111010110101101000111011010110111111100010110000001010100010001011001010001011111111110011111111011')], [bitarray('001010110011001000100111010100101001100101101010101000100101110110000001010111110001111001000110000000101110'), bitarray('000010110010010111110111111100101110001010100010101101000101000010100111000101001101111000001011010000000011')],
[bitarray('110111101101010010000001010100110111001100100111010011011000000010011111110011111110010110100011011101010011'), bitarray('010100100101010011111101000011111001111011001100010010100011011100110111000001000111000010111010011110101111')], [bitarray('010011010001100000101011110101010011011001101000011100101010001100110110000010100111111001101000101000000010'), bitarray('011011111110101000011001100000000111000011101001010110101000010101111000101110101010001101100001100111010000')],
[bitarray('010011101101110010000101011001000001000000110011110010000010111101100111111001101011100111000101010100100110'), bitarray('000101100111000010111000111000111110110101111000101011100110011101000100010000010001001111001100101100111110')], [bitarray('011111010010011100111010111110010110101001101100100010110000011000101011000111000100001001011000000100111111'), bitarray('000010010011100011001101101101101111000110000101101001000110001000111000111010101111001011111111111000000000')],
[bitarray('110001001001101111000101001101000100010000010101000011001010101100101001000011000000111010100101010101010011'), bitarray('010101010110010001011010000100011100001111110010111110000111010100100010001100110001010000001011011000011000')], [bitarray('010111101111010000000011000001101100111111000101011011001011101001100010001010111010000100000001011100111010'), bitarray('011110001000001110000010111101001111000011111100110100100110011001111100110100101100011100110001101000111111')],
[bitarray('000011000001110010100110001101100000000000100000011101011111000001001101000011010011111010100101000101000110'), bitarray('011101110100010000011010010100011000101100101011010111100101011000000100010001100110010000100101001110101011')], [bitarray('010010011010101100000110011100101011010100000111001101001110100001110101001111001111101000100101001101110110'), bitarray('000110000010000010011011111011101001111100110000000100000000000001000110011110101011100011010001110111100111')],
[bitarray('110101011010101111000101011000100110001000110011000111111000111100101111101000001011011011000111000001000011'), bitarray('001000000001010000000111000111011001100100101011010111100110000001100111001000100011000001110000010111011011')], [bitarray('111001100001010000001010100000000101001011011111000111111111011110001001010110111100000101111001101101001001'), bitarray('011000101100011110011101100100110111000011110001101001111001001001111100111110101010101100101111001011000000')],
[bitarray('101000001000011011100101000001000101010000000001000101110001011011001100111100010110010011000101010000100100'), bitarray('010101110011110011011000110110100111110011011111011010000011011101110101010001010001000111101111010111111111')], [bitarray('011011010000111000010110001000101100101001101011111110111110010000100111010010110110000101100011001100101001'), bitarray('111001100010011101110111100100111110000010000001001100000111001001011001101001001011101100010011111111000001')],
[bitarray('110111001110010110100011010100110101000100100110001011011000001110001101110111011100010010100001000100010011'), bitarray('000100110000000110011110011110101011110101011000100111000101001001110001010100010001011111001101101000001101')], [bitarray('011110110101001101000000010100001011101000010001001101010010101100111010010110010111100001000101101001000111'), bitarray('111011000111011011010010010011001110010110110000111001101010000111110011101001100010011010000010101110101101')],
[bitarray('111001001001101011100110010001110001000000100101011111011000111000101011101111010100000010010101110001110000'), bitarray('010101110000111111011010110100111001100101010011100111100010111101001111100110011001101000100110001100011111')], [bitarray('011010011101000101101000101001111000000101101010010111011001110001010001000010110101100000011011100101111011'), bitarray('000110111010011111001001010111001011011010100010101100001000011110111111110100000111101100010101010100100111')],
[bitarray('101001001010100011000100110000001001000101111111001110000011010010000001101000000100110010000010001101000110'), bitarray('100001000001011101111100011111110001100000010100111111100001010100000100011110111010100100100111111110111011')], [bitarray('001110101010000100000001000000011111011110111011011111000111100100011011010110101101001001000111001101011101'), bitarray('001110000011100011000100110111000111011111001001110100000010010001001010010010101111010101111000011011111011')],
[bitarray('101101011000001011100010000000110010001010111101011100010111111100100010110000111110000100000111010110001111'), bitarray('011010101001110011110000001101111001101100111010000101000001010111101001011011010111000110110001001110100111')], [bitarray('001011101111111001000100011000001101000111100010110101001110000101000110011011101001101101100001011000010100'), bitarray('010010001111110111101001101101110110000010011110110001100010010000010000110011100010101011000011110000011000')],
[bitarray('100101111101001001010111001100111000000000000100110110001001011110001100110101101010000000000000011101011001'), bitarray('000001001110000110111001000001010111100000001110011101100000000101111011001111011001110110001011111001110111')], [bitarray('010110011011111100001101010011000111110001001011000101011011011001011000000010111111010101001000011101111101'), bitarray('111111111011010100001110001101011000010011001101011100110011011101011101100010110000001111001100100000000010')],
[bitarray('110001001000000000000010000100011001001100111101010010001011000100010111111001001001010100000010001100110010'), bitarray('100110110101000101110000000010000001110101101010011001101010001110100111001110101111111111110001011001110000')], [bitarray('001010011100101100100000000001001111101011100110010101000111010010100011011011111001110001000011001001011111'), bitarray('110000100100101001000101111111100011010011001010110001000011011101101100100101100111110000000110101110010001')],
[bitarray('110001101010010001101001000110000011000111101111110011000110011101100001100100101101000101101010010110010101'), bitarray('110110100010100010111100001000011011111100111000110101101100010000010111110101110011010100111100100110010001')], [bitarray('010011111111100001100111110101011100111100100111110010011111101100011100110100100111000101100100100001001010'), bitarray('011011111010000010001011010111000100110001000001000001101111001010101011000011110111000011001011001100101111')],
[bitarray('101010000110011000101100110001100000111000110000111001011010100110100111111100101101101101011001111100110010'), bitarray('110100010011000011110110110100111010100100101011001001011001010100101001000100010010000100111101110100011000')], [bitarray('111101100010001101101100011010011111011010000110000110011011010101011000111100110010010001101000000111011100'), bitarray('010000001110011111011101111010010111100001100000110001101100101000000110100111011100101000011100111011101111')],
[bitarray('101001101000011001100101001011001100001100111000001111110100110001101011111000000111111100100011000100001101'), bitarray('001101111000101111111101000111101001101100000011111001000111000101111110001100110000001110111100010000110010')], [bitarray('101001000000100001101110111000101111000001110100110011000011100101011010110101100101111000001010111001110010'), bitarray('110110000100001101011000100000100100101001000111101101010100111000110000111101100000001010011000101010110111')],
[bitarray('101000101100001101000011000001110100110101010101100001110110100110010001110101001110001101001100111110100010'), bitarray('011110111110100101001010000110111111101001111001001011000011001100000100001110001000011001100010111100100110')], [bitarray('111100100010111001101111111011110110000010101100010000011000011100100100110000100011110001101111110111010100'), bitarray('001010001110010000011011011101000100110100110000111101001110111111010110001010001110010000011010001100010111')],
[bitarray('101101101011000110000000010001000100101100100000111000111010010101111111101101011001000011000000010001000100'), bitarray('011111111010011101100001101001000001110010001100001010000110011001110000010011011001010010111100110000110010')], [bitarray('101000100110111100101001110110110110010010000110110001011101000111011001101100010100111100001000110111110110'), bitarray('011011100101111000011101000111011001101101110110100100101100111111110001010001001111110100011000100100100011')],
[bitarray('101000000110111111100010001101100011001110101011101100100111110110011101100100110100111111100000000100100001'), bitarray('011010001100100000010100101110111011111001101100001010100101011000000110011110010101101101000010101110001100')], [bitarray('100001110100101011110100010100010001011000110100100000010100001100010111101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
[bitarray('110100101011110000011010100010110100011111010100010010000111100011000111101100111000101001001000000011000011'), bitarray('001110111100101001001010100011010111111100111000111001100010100000010100101110001000101100110001100101010111')],
[bitarray('101101111100101100000101011111110110110101000101100110100101110100111101111111100111000101100000011011101101'), bitarray('011110011101000011000110100100110111110110000100001101000111001011110010110111011101010001001010011000001010')],
[bitarray('100110100100001000100001010000111011001001110101010010111001111111110011111110010001001001100110010101101010'), bitarray('001000101100110110001111111001011001100110110001001100000010001111010110111010000001110100111100011110110011')],
[bitarray('101010010101101001100011001011100101111100010100000011100111001100010001100010010110100000000000001010110011'), bitarray('000010001000111110001110101101101110101111001001010111100111010100000010001100011111100010001011010101110110')],
[bitarray('100000011101111010100110001001100101010110110010110010101010001100011001101000100010011110000011011101010000'), bitarray('010001001100001111111101111101111001111100010101011111100101011100010110011101000111101111001010110010010011')],
[bitarray('011000001000000011101000111100101110101110111000001101010000111001101010100010010100011010100001111101100001'), bitarray('011111011101111010111111010110000100101110011011001011100001011101110011001110100000101111111000111110011111')],
[bitarray('101110111000001011100000011101100100010111010000100110001101101011001111110000111110010010100011000001000000'), bitarray('011000011000110001010110000101000011111100001100010010000010000001000010010101001101111100000100010000110011')],
[bitarray('101000001000011011000101000001000010000101100011000100010011011111011001111011101100011110000011010101010011'), bitarray('001100010101011011001001001010111101111011011101011110000011001100010011010101100011010110111111000011011101')],
[bitarray('111111001100010010000001001100010101000000110100000011001110011111011001101111010010010110100001000100110000'), bitarray('010000110100110101000110110111000101000100111101011010101011000111010000010100010010000001011001000100001111')],
[bitarray('100011000001010010000011001100100000000000010001111000110100100110000100101011100000010110000001011101000100'), bitarray('011001100101101101010011101110100010110001101000101011000101010001010011001000110101010110111101101100101111')],
[bitarray('110101011000101011100101010001010001010000110000011111001001100000011111110101001011100011000101010001010111'), bitarray('000000110101000111011010100100111110111001101001101111000111001000010111011101100011001110001100111100111001')],
[bitarray('000010000010011011000011010010010011000101110101000110111001000010000101111001011000100011100110010001010011'), bitarray('000100010111010110111011100000011111111101101000101111100111001000010001010001100100001110011100101000111111')],
[bitarray('110001111001101111000111000100000111010101110010000011011111101101111101101100011100111110100101000101000001'), bitarray('001111000100100011001010011101001101010110101011100011011001000100101111010000010001111011010111111000001111')]
], ],
'connected': [ '0': [
[bitarray('111001011000100011000101010001010001010001000011011110011011101001001100111010000010100010100001001001110100'), bitarray('010101010100110010001010010101110010111011101101010110000001010101010101011001010001000110001000011110111010')], [bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('110111101110010010100001001101010001010001010011010011011100011011101111111011011101011110000001000101110101'), bitarray('001000100010000111111100001011111011110011101100010010000000011101010011010101110101011010001101010011011110')], [bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('110111001101010110100011000100110001001100010110000110111010011010101000111011001110011010100011001101110111'), bitarray('000100110100001110011000001110101110111101011000100111100101011001110011011000010000011011011001100101001111')], [bitarray('000110011010000101000001001001011010110001000001101010011000001000010110001010101000001000100011000100111011'), bitarray('000010011011001111010000100100001011010111001000110100100001010000011101011010001110001001011101001111101010')],
[bitarray('111101011010100111100101000000010101001001010111000010001011110100111011111001001011100011000111010000110111'), bitarray('010101010001001010011100101101101111110001111000100011100111000000010011001000010101010111001111101000111011')], [bitarray('000011001010101101111101010101011010011001001101010111001010011100011011000011101100110101001101001111111111'), bitarray('010101110001100010000111110110011010100100100101001100001110011010110110100110001110100000100011110010001110')],
[bitarray('100011010011111010000100110000001101010011110010100111000101011101010100110001001001110111001001111001111110'), bitarray('111101010100101101101110110100011011100100001110110001111101111011110000001111001101110011010111100000001111')], [bitarray('101000100011010100101101011100100010101111100100000000001110010101001001110101010110000001001110001101110000'), bitarray('111101110100110000001110100000001101110100110110101000001010010010100000101101000110110011101011110110110111')],
[bitarray('101101101101110101011101000100101000100111010101010111111001111001011111110001111000101000000001000111110001'), bitarray('010110010101111011101101000110001100110010100000011000101100010010010110001111111001001111000000100001101001')], [bitarray('111001100111111001000000101011000111000011001100111011011001100111110001111001100000100001100010101001110001'), bitarray('000111100111011011010101001100100001111101110010100001000010111101000100001111000000010111000001000101100100')],
[bitarray('110110000000011100001100010011110101011010111001011111010001100001011001100110000001010001010011001111111001'), bitarray('101110010101010111101100111001001110110010100111101001110100000000101010110101010111100100011111011011110110')], [bitarray('111000100001110101010101111100000101010000001000010010010101100110101111111001000100111101101001110100100010'), bitarray('000100111000110101000000000100011011100001100010111000001101100001110100011101110000010000010100011110010111')],
[bitarray('110011000000100000000001011011101000001101111101100101001011110011010111100010110101111001100011000010101100'), bitarray('010111011000010101001111011111110010101111010100100001000101001011001111011000000001010000001110111100101011')], [bitarray('101101110100101111110100001001000110010100000110100101110000010001110110111111111010110011100000010100100010'), bitarray('010010010101110100110110011100001101101011001010101001000000001000000000000001000100010000001000000010000000')]
[bitarray('100110110100101000100101110000010100010011000100001001111000010001000110000011111000000010101110101110110101'), bitarray('000100101001100101001001011100101001110110100011010010110110111000110011101100001000101010000110110100000000')], ],
[bitarray('100011110001010110000011011101110101010100010111100100100011101110110111100000001000011011100111010001000010'), bitarray('001101110001010100110010001111111100111000101101010110110000011000100000010101001010100101010000000101110100')], '1': [
[bitarray('110100101010101110110111100110011010000011010110001011011010011101000111001101000001101111011000010111010101'), bitarray('100011011100011000100011110111111111111011100110011001011110110011110111101111111000110000110011101001100110')], [bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('100111100100111001001110001001000101100001001001000100101100011101100110110110100110110001100101001001110110'), bitarray('011111001000111110110101010101000010101110000111100100100111110000110001010110100100011001111101011001100011')], [bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('111011101100010110100001001100010111000001000110000011011000000011011011100111111011011011100111001101010111'), bitarray('001000001001100011111101010100110101001011101110001011001110111101111101011100010111100110110001011100100010')], [bitarray('001111101011000100000101011101000110111010111110010100001011011000100110000111001000110000000110000010100001'), bitarray('011011001111100111000111001101011000000011101000111000100011111101100100001011000110000100010011101101000011')],
[bitarray('110111100000110010000111000000000111000011011000100010001110100110001110110111100000110010000110011000100011'), bitarray('011110001110110010001001100011011010111110100110000011100001001000010100000011100101001000000001011111000011')], [bitarray('011011001010100100100011010101110111110001000000011110010101010101011011111100010001000000100000000001100011'), bitarray('001010101101100011110000111010000001111000100010001100100001001001010100011010101000101011010001101010110111')],
[bitarray('110011000100011011000100000000110110000001001111000100010101110001011111101011110010011010000001001000010010'), bitarray('011100110001111000110111101110000001111011101111011110100011011100010101000101010101011110011000011011101010')], [bitarray('111000100001001001100011001001010100111001010001010010001111000011001101101100010110000101100010100111000111'), bitarray('000011011000111100000100011100000101101101010010111000000111101011100010011010100101011011001010101001101011')],
[bitarray('000110010010010011100011011011000010010100000011000010111101010011000100111101001001100111100111011000010111'), bitarray('001100010101000010001100110100111001110001101001100011000101011100110101000000010101000111011010101100101101')], [bitarray('100100000000100100100001100011010011010001001110001110011000001010110111110001100100110001100000100110100001'), bitarray('001111101001110110001100100110000101100101000101101100101101111110110111011001101000100001011110111001110011')],
[bitarray('111001111000100111100111011101110011010101010000011110001100100100101111100011110000011110100011001001010000'), bitarray('000100110000110100000101110111100111001101000000101110001011011011010010001001110010110001101111011110010001')], [bitarray('111100010001110001101110110111110110000011001100010000001100010001000110110100111101010001101011100010000000'), bitarray('000001100000100000001001111000010111010011001100111110100110011100110101011101010011110110010000110001110000')],
[bitarray('111101111000101011000100011001010011011101000000011110011100100001111010111001101011101011100101001000010111'), bitarray('011000110001000011001111101000011101111101111010100111000101000000000001001000000001011111011010110100001001')], [bitarray('110011101011111011100000011100000000011010100111111100010110011101001101110010001001100011000101011101100010'), bitarray('011000111100100101100010101111000101110010011000100011000100011101100010011000111100100101100010101011000101')],
[bitarray('110001001010101111000111011000100101001100100010010111101100101001111010110101111000101011000101000000100011'), bitarray('000100010100010011011111101101111111110001001001101111000100000000010000000101110011011010001111100100011100')], [bitarray('110010011000100011000100011101100010011000111100100101100010101011000101101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
[bitarray('111111001101011010100001001100110001001100000001001010111100010111011010110011111100011010100011001101010101'), bitarray('001101100100001110001100001110111100111111001101011110000011000101010111011101110001000110011011010011011010')], ],
[bitarray('110011101100010010000000011101010101010101000011000011101000001111111110110010000011101110100001000001110000'), bitarray('001000010011110110111111000001110111111110010000100010100001011000110001011100000110111110011100011100010001')], '2': [
[bitarray('110111001101010010000011000101110001011100100001010011001010010011101011111011111110011010000001001100110001'), bitarray('000000000001001010001011001110001100001101001111101111001110001101111111111011011101000100010101000101100110')], [bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('100111111000011111000101011100110001000001011110110010111000011001010001100001010010110011010011100100100111'), bitarray('011000010100100011001000011111101101001000100000000000000010000001000000001000100000010000000100010000000000')] [bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('110000000100010000000111110101100001000011101100110101111000111100111111100000100000100000001000101001000000'), bitarray('001110101010000000010101110101101110100100100011100101101010111000010010101101010010100100111111010001100101')],
[bitarray('110000100001111001001101100111000110000110111110010100011100000001010011100000100110110000001010101110110110'), bitarray('011111010100110100001000001011011110101100011000010000001101110010100110010000111110010000011101111110001111')],
[bitarray('101000100010011101001000110110000111000000000011000110010000001001011011111100010101010111010101011101000100'), bitarray('011100010001100010011011100010110010110110011000100011000100011101100010011000111101101001000010101011110100')],
[bitarray('111110011010100011100100011101000010010000011100100001100010111011110100110110011000100011000100011101100010'), bitarray('011000101101100001100010100011110110101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'3': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('010010100001100001000010001101011011001000111110001111000001000111100011010011101110011001000010011100101110'), bitarray('000101101010111011000011011101101111000111011100111101100110011000001100001010100110101000011000000101110010')],
[bitarray('010010101010100100100101011001111111011100100101010000101101101100100110010010101000100000100110010101011100'), bitarray('010100110111010000111110111100110011101101010100011100100010000001000101101110000101101011011010111111111010')],
[bitarray('101000100000010100000000111100100100110101001101101100010100011110101010101000000011011100000010111100010101'), bitarray('110101001100101100000001000110011010100101100101101100100111111000000101001011011011110011100110011110101010')],
[bitarray('100000000110111000111111010001110111001011011001011010011001100110000111111100000001110101011001010001010110'), bitarray('001010100001110010011110110000011110100000100111111100011100011001000101001011001011010010011100101111100110')],
[bitarray('111100010010111101001001000101110110000110000111100011011000100100001110100100101001010000101110111011110000'), bitarray('000001101111010100011100110111011010111001010010101001001010101011110110011000100110000000011101111110011110')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'4': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('001111001110110001100001110011011110000111111111011111011001101000001110010011001010111000000110111111111100'), bitarray('011110010000100110001110101111010010100000010010001000001101000001101001001100001010000111000111001110101111')],
[bitarray('111000110110000101001001011001111001010001000000101010000100001100000011101100100110010100101101001111001101'), bitarray('011000000100110010001011101001011001110000010010000001001010010111110111110010100100001000000101110000000110')],
[bitarray('101001110011100101001010011010001100011000001110000001000110011100000011100001010000110001101000000011000101'), bitarray('101011100010001110011001011010110000111101110110111000001110011011100000111110101100110011011001001000101001')],
[bitarray('101000110011100101101111010011000000101000101110001011011100110000011011100100110000101101101110010011000010'), bitarray('101000001100010011111010111000011011101100010100110001101110000000000011110100100000100111000101010010011100')],
[bitarray('111100100101101001101111110100000110010010000011100000010000101011100010101001010011110000001101101000110010'), bitarray('010101110011000001010101011011000000101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'5': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('000110011110101101100001011101001101000100011001100100001011111010011010001011101000100101101110000101011111'), bitarray('010101111111000011111000001100011000100100000011001100101100001000001101011101111011010011110101010011001011')],
[bitarray('101000000000000000101101000000011100010000011101001111000110001110101011100001110001010000000111111100101000'), bitarray('010100111111101111011011110110000111111001000111011101000001111100001001011001110101011011001111100100011010')],
[bitarray('111100110111010001011000011101010010101010111010100101111001000010000110100000010100110101111111010000000000'), bitarray('101001110101111011000101000011111001100100000000101001101011100000000101110000010111100100011001010001000111')],
[bitarray('101000110000101100001011100000010110001111101010010000010000110001001011101100000100110001101011111011110011'), bitarray('111000011100000100010011111010110100101100110100101101101000111110101011011010100110011011111000101100000011')],
[bitarray('110101110010110111100011001100001111011000101101110010110101101000110100110100111010110110100011011000100101'), bitarray('100001000101110011010100100111001000011100010011101111110000011110000111000001001000100011011000101010001110')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'6': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('111000010110100001101000010011100011000111101011011111110101000111001110110000110101010111100111010100010101'), bitarray('001101100101110011011110111111110110101100010000010001111011111110100010000101000000001110110010010000011100')],
[bitarray('100101110110100000101101111011100100001101001000100101111010101100110100111111001000011010100100110100111101'), bitarray('111110101111011111111011001110110100001011110011100110001010101101111110101001100010111010001111011001101111')],
[bitarray('110101011001100010000111000100110000101011101100100011000110010000100110100111111000010010100101001101010001'), bitarray('101110100000010110100100100000001101100010110001001110000111001101010100000011111110101001010001001101111000')],
[bitarray('111101001010101010100100010100100111100010101100110111110010011000110110100100011110111111000111001101000011'), bitarray('110100101111011010000001110101110010111011110011111010100101010000110001011011001011101011101001100111101011')],
[bitarray('101110110111100111000101001001010111010000001000010110111010011010011010111110010011101110100000000000110011'), bitarray('001000100101110010111111011100110100111010101010101011100111011101100110000100111100110101010000101010010000')],
[bitarray('110001010011010011011001011000100101010001000110000101011010000000010000001100010101011011101000111000100100'), bitarray('000001100010101001010100001010100100110011001000111111000010011101000100010111110001110000100100011000001001')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'7': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('010010110001100100000010000100111111101010100000111011011001111010001000010110111100000100000100001101101100'), bitarray('101100001111000010001011011111001101011111011000111101100000010001101111111001010111100000000110111110100010')],
[bitarray('000110011010110001011000011101001101011110100101000110111000101111000000100101010011000101111001011001000001'), bitarray('000111000111100101010110011110101011111101010101000000011101001001110011000010001100001100000000010001000011')],
[bitarray('110100000000001100100000001101000000000010011111100011010011110011000011100000110101000101100101001101100111'), bitarray('001111100111011010010000100000011011111000100001001000000011000101010000010110001011111011010011110111000011')],
[bitarray('110001010101111001100010101010000000001011011101111110001110101010110010100101000010110000000100100010100011'), bitarray('000010100110010111101011101001101111110101010110110101100000101011010010001011011001111010011101100110100111')],
[bitarray('101101010010111100100111100111000110001110110100001010011100101101111011100100110011101000100000100110000110'), bitarray('011000101110010110011000011011110011100001010111100000001110111010110101010100101100110001001100101000010100')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'8': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('110000011010100110100000001001001110000010011000100100001000110100111111101000110100101011101100101101101001'), bitarray('111111001100011110100011111011001101101011100011001111000010011001101110011100010000010011010101010101011010')],
[bitarray('110011110101011110000101000101100101100011010100100000101111001101110111110010010101000111100010011101000101'), bitarray('000110010110010101000011001111000101101111010011011110000010011101000010001100010001100001110011100011000111')],
[bitarray('111110101011100011100100010101000100010000101101100101010000100010100001101110101101101010000011010100100110'), bitarray('001001000101010100010101100000001101101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'9': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('010010001110100101111111001101110010011110111100001000011101000110010111010110111100100001001110011101010101'), bitarray('000010101110010000011010001111000101110000100001001000100011000000100100010010001100101011000000101111110001')],
[bitarray('111100110010001100000010000000000101011110111101101111010000111111100011110000100011001000000011000001100001'), bitarray('001011101100100011000110110111000110110100110000001101000011011001110110111001100101000010001001010111011011')],
[bitarray('110100010010000000000011001001110011000011101100100011000000110111000011100100110100000101100101001101100110'), bitarray('001011100110010010010010100000001011100001000111011000101000010111110110111001010000101100010110001000100011')],
[bitarray('100101110101010100001101100100010101110001101010011111010011101000101110101000110001000100001001100110011001'), bitarray('000001010101110000010011110010010010111000110000111101001101111011000111001011001001000001001001011001000100')],
[bitarray('110001010001100001101001100011110100000100010110010100001101101110011111111000110101010011100111010100100111'), bitarray('000100000100100010011000100110010101110110001000100111000100011101000100010000111101101000110101100010110011')],
[bitarray('111110101010101111000110011101000110011001011101110001100111100011010001101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'disabled': [
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('101011001010101001000000001000000000000001000100010000001000000010000000101011001010101001000000001000000000'), bitarray('000001000100010000001000000010000000101011001010101001000000001000000000000001000100010000001000000010000000')],
[bitarray('001111000111111001000001001101111110111101100010011111001010011011101111000011110110111101100001000101011010'), bitarray('111100000010010011101000011111011100001111110101111100000011000101011100011011011100101010000011111110110011')],
[bitarray('000000100100010011111110010011100100011100001001001011100101101011101000010110111111101101011011100010110100'), bitarray('011111100001110010001110111011011110000011101001010000011011110001001101011011011110110010001111000000100101')],
[bitarray('010110111100001000111110010011101111100010001100001000100101111000110101000010101010000000010111111010011011'), bitarray('000110000101101001000001001100100001000111011010010100100100011100001101011101100000001010010111001111110101')],
[bitarray('010010001000101100000100010001001000011001100110001100011001101100010101000011101100100101100100011001010101'), bitarray('100100111111111011010101011110110001001111111000100101100010101101111110000010100111110010100010001111111111')],
[bitarray('100000100000011100000011111000000000110100001101100001100000001111111111110100110100011101000101111001110100'), bitarray('111001100110000000100111011101010001100001000001001000100110110001110001100010100111110001010111101100000001')],
[bitarray('110000100111011101100100110101100010110001000100000000000010011101010001111100110110010101100101111101000001'), bitarray('111101100110000100100011011100110001101001100101011001001011001110110101001111011000000100101101110100001011')],
[bitarray('100100110100000100101001111100010111111111010011001011110010010111000001110100110000110001001111101010010010'), bitarray('000010111010000101011100001101000001100101100111100111110101010001010111000001100000101000010101011101110110')],
[bitarray('101001110110101010000100000000110001100110001110000001111001110101011100100101100000011010111010101100011001'), bitarray('100010100000110101101001011111110010100110111001001011000000001100010111001011110000110110111100110010011111')],
[bitarray('110111111101011110100011010001010001000001110000001011101001000010001101110110101010101011100110011101000010'), bitarray('001101101001110101010001101111000001101011001010101001000000001000000000000001000100010000001000000010000000')]
],
'enabled': [
[bitarray('010011101100010000101011000011111110110001110110001001110101000111111001011010001100000001100011101111001101'), bitarray('001111101111000000110100010110011101010111011000111001100000000001001010110001100110110000100001110110100010')],
[bitarray('011010101011101100000111011001011010010101000101001000001101111001110101010010001000101000000111011101101001'), bitarray('011000010100001000001001110101000100110001000111001101000110001011100100100010000000111010000001001111010001')],
[bitarray('100000000010010100100000110000010011111001001100101000000101011111011101100101110100010100000011001101000011'), bitarray('101111010101101110001001100111111111111101010110001101000000101101110110101010011000011100000101101111111101')],
[bitarray('100001100111101100000111111000100000000010001011101011000111010110111111110000100000101100000100111001101101'), bitarray('010001001010111000000111001101110111101001000111100100000100110000000011000111111000101010000001011110011101')],
[bitarray('110100110000111000100101101001100100101010010010111011011001010110110011111100110100100101101000011011100000'), bitarray('001010011110000010110001000111011100110101100111110001001111011011100100000000000100011011010111110000100010')],
[bitarray('100000110100001001101101011110010011010000100010011100111111011010100011110101010110001111000011011100010111'), bitarray('011011101100111011011011010101011011000001001100101011101100001101111010111011111100010101100111001001110110')],
[bitarray('110101101110001110100111011001110010011011000000110100010011101010001000101101011011001100101001110010110010'), bitarray('010010000000010001111001001001100010101011001010101001000000001000000000000001000100010000001000000010000000')]
] ]
} }