© Copyright 2011 Vincent Chapman, N1LQJ and Jacques Richer, N1ZZH
Maybe freely distributed and reproduced.
Abstract: Base 37 callsign to IPv6 /64 subnet address
encoder. Allows up to 7 characters and 185 nodes and
contains unique identifier for quickly locating,
filtering and authenticating IPv6 addresses as valid
Amateur Radio Links.
Handles Callsigns
0000000-0 (::0200:0041:5200:0000 )
through
' '-184 (::F2F9:1041:5273:5E64 )
Package includes the following files
callsign.c Library with Encode and Decode Functions
callsign.h Include Header for Library
callsignv6.c Program to translate callsigns into address
ranges
calltov6.c Program to translate a callsign with node number
into a single IPv6 Address
v6tocall.c Program to translate an IPv6 address into a
single callsign with node number.
The Base 37 System
Callsigns shall be encoded in Base 37 or 37^n.
Conversion Table
BASE 37: 0 -- BASE 10: 0
BASE 37: 1 -- BASE 10: 1
BASE 37: 2 -- BASE 10: 2
BASE 37: 3 -- BASE 10: 3
BASE 37: 4 -- BASE 10: 4
BASE 37: 5 -- BASE 10: 5
BASE 37: 6 -- BASE 10: 6
BASE 37: 7 -- BASE 10: 7
BASE 37: 8 -- BASE 10: 8
BASE 37: 9 -- BASE 10: 9
BASE 37: A -- BASE 10: 10
BASE 37: B -- BASE 10: 11
BASE 37: C -- BASE 10: 12
BASE 37: D -- BASE 10: 13
BASE 37: E -- BASE 10: 14
BASE 37: F -- BASE 10: 15
BASE 37: G -- BASE 10: 16
BASE 37: H -- BASE 10: 17
BASE 37: I -- BASE 10: 18
BASE 37: J -- BASE 10: 19
BASE 37: K -- BASE 10: 20
BASE 37: L -- BASE 10: 21
BASE 37: M -- BASE 10: 22
BASE 37: N -- BASE 10: 23
BASE 37: O -- BASE 10: 24
BASE 37: P -- BASE 10: 25
BASE 37: Q -- BASE 10: 26
BASE 37: R -- BASE 10: 27
BASE 37: S -- BASE 10: 28
BASE 37: T -- BASE 10: 29
BASE 37: U -- BASE 10: 30
BASE 37: V -- BASE 10: 31
BASE 37: W -- BASE 10: 32
BASE 37: X -- BASE 10: 33
BASE 37: Y -- BASE 10: 34
BASE 37: Z -- BASE 10: 35
BASE 37: {SPACE} -- BASE 10: 36
Algorithm for encoding
Callsign (Illustrated with Variables)
abcedfg-h
whereas a through g are base 37 characters and h is the node number as a base 10 integer.
((a*37^6 + b*37^5 + c*37^4 + d*37^3 + e*37^2 + f*37 + g) * 185) + h
For callsigns less than seven characters long, 36 * 37^n (Space) shall be used as a place holder.
Subsequently, upon decoding, callsigns are Left Trimmed for the removal of the space character.
The bits of the second octet
::-X--:----:----:----
The second Octet of the 64 bit subnet is structured as such:
8421
rruL
Where 'r' is reserved for future use,
'u' is the universal bit, and 'L' is reserved for implementing extended length 8 character
callsigns with a maximium of 5 nodes. (Reserved but not implemented)
Universal Bit (If bit 2 of the second Octet is set than the address can be routed globally)
'L' bit is reserved for possible future implementation [ abcedfgh-i ]
whereas a through h are base 37 characters and i is
the node number as a base 10 integer.
((a*37^7+b*37^6+c*37^5+d*37^4+e*37^3+f*37^2+g*37+h) * 5) + i
Amateur Radio Identifier
Globally unique Amateur Radio Identifier of 'AR' for Amateur Radio is inserted into the 7th, 8th, 9th and 10th octets.
Amateur Radio Identifier is as follows and allows the detection of Amateur Radio Call signs for filtering and decoding
::-X--:--41:52--:----
________________:________________:________________:________________
ccccrruLcccccccc:cccccccc01000001:01010010cccccccc:cccccccccccccccc
Where 'r' is reserved, 'u' is the universal bit, 'L' is reserved and c are the bits of the encoded callsign.
Sample Encoding of N1LQJ-128 from callsignv6 in terminal
vinnie@abaddon:~$ callsignv6 n1lqj-128
Amateur Radio IPv6 Address Callsign Embedder
The Technique uses base 37 encoding;
Supports upto a maximium of a 2x4 callsign; and,
Supports no more than 184 nodes (0 thru 184).
Your IP Address shall be pursuant to RFC TBD (Proposed)
RFC TBD prevents Callsign Duplication between Various IPv6 Ham Networks
The Math
Callsign in Base 37 (Integer)..... 94905719262
Base 37 (Integer) x 185........... 17557558063470
17557558063470 as Hexdecimal...... FF7F002F16E
Unique IPv6 Address Translation
Univeral Bit is set............... ::-2--:----:----:----
Amateur Radio Identifier is Set... ::----:--41:52--:----
Node (128) Specific Address....... ::F2F7:F041:5202:F1EE
Node ( 0) Start of Address Block. ::F2F7:F041:5202:F16E
Node (184) End of Address Block... ::F2F7:F041:5202:F226
vinnie@abaddon:~$
Example of N1LQJ-1 in use on actual node
vinnie@abaddon:~$ ifconfig eth1
eth1 Link encap:Ethernet HWaddr 00:0c:3d:2a:f1:ba
inet addr:44.124.128.128 Bcast:44.124.128.255 Mask:255.255.255.0
inet6 addr: fe80::20c:3dff:fe2a:f1ba/64 Scope:Link
inet6 addr: 2001:420:c:1a5:f2f7:f041:5202:f16f/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:149023 errors:0 dropped:0 overruns:0 frame:0
TX packets:155231 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:34288787 (34.2 MB) TX bytes:33515507 (33.5 MB)
Interrupt:21 Base address:0x1000
vinnie@abaddon:~$ v6tocall ':'$(ifconfig eth1 | grep Global | cut -b 37- | cut -b -20)
N1LQJ-1
vinnie@abaddon:~$
------------------------------------------------------------
Configuring Network Device with embedded callsign
------------------------------------------------------------
vinnie@abaddon:/etc/network$ cat interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto he-ipv6
iface he-ipv6 inet6 v4tunnel
address 2001:420:b:1a5::2
netmask 64
endpoint 66.220.18.42
gateway 2001:420:b:1a5::1
ttl 64
auto eth1
iface eth1 inet static
address 44.124.128.128
netmask 255.255.255.0
up ip -6 addr add '2001:420:c:1a5:'$(calltov6 n1lqj-1 | cut -b 3- )'/64' dev eth1
up ip -6 route add 2001:420:c:1a5::/64 via 2001:420:b:1a5::1
vinnie@abaddon:/etc/network$