Move from udp to ax.25

This commit is contained in:
John Burwell 2025-04-27 11:36:53 -05:00
parent 738ea6e75e
commit 42cd5f37bd
4 changed files with 9 additions and 4 deletions

View File

@ -102,7 +102,7 @@ That's what the 'S' in CRAPRNIAC stands for.
## 8. Other Considerations ## 8. Other Considerations
- CRAPRNIAC does not prescribe a particular lower-layer protocol, though it is designed with a working AX.25 stack in mind, whether that's a classic serial TNC, a more modern bluetooth doodad, or Direwolf with kissattach creating an ax0 interface. The example implementation uses UDP packets over IP over AX.25. - CRAPRNIAC does not prescribe a particular lower-layer protocol, though it is designed with a working AX.25 stack in mind, whether that's a classic serial TNC, a more modern bluetooth doodad, or Direwolf with kissattach creating an ax0 interface. The example implementation used UDP packets over IP over AX.25 until the author realized it needed IP to be up already before it could work. Now it does everything in AX.25 directly.
- CRAPRNIAC will squat on an amateur frequency of the operator's choice. - CRAPRNIAC will squat on an amateur frequency of the operator's choice.
## 9. Conclusion ## 9. Conclusion

View File

@ -1,11 +1,14 @@
import socket import socket
import time import time
import threading import threading
import ax25
import ax25.socket
BASE_CALLSIGN = "KI5QKX-10" BASE_CALLSIGN = "KI5QKX-10"
NETWORK_NAME = "HAMNET-HOUSTON" NETWORK_NAME = "HAMNET-HOUSTON"
BEACON_INTERVAL = 10 # seconds BEACON_INTERVAL = 10 # seconds
BEACON_CALLSIGN = "CRAPR-0"
# Fake IP pool # Fake IP pool
IP_POOL = [ IP_POOL = [
@ -69,13 +72,13 @@ def handle_request(data, addr, sock):
def beacon_loop(sock): def beacon_loop(sock):
while True: while True:
beacon = build_beacon().encode('utf-8') beacon = build_beacon().encode('utf-8')
# Beacon to *broadcast* — here we'll just send to our own callsign for now sock.sendto(beacon, (BEACON_CALLSIGN,))
sock.sendto(beacon, ('CRAPR-0',))
print(f"Sent beacon: {beacon.decode('utf-8')}") print(f"Sent beacon: {beacon.decode('utf-8')}")
time.sleep(BEACON_INTERVAL) time.sleep(BEACON_INTERVAL)
def main(): def main():
sock = socket.socket(socket.AF_AX25, socket.SOCK_DGRAM) # sock = socket.socket(socket.AF_AX25, socket.SOCK_DGRAM) # Old python networking way
sock = ax25.socket.Socket()
sock.bind((BASE_CALLSIGN,)) # Bind to our station callsign sock.bind((BASE_CALLSIGN,)) # Bind to our station callsign
print(f"Base Station {BASE_CALLSIGN} starting up on {NETWORK_NAME}...") print(f"Base Station {BASE_CALLSIGN} starting up on {NETWORK_NAME}...")

View File

@ -1,5 +1,6 @@
import socket import socket
import time import time
import ax25
CLIENT_CALLSIGN = "N0CALL-7" CLIENT_CALLSIGN = "N0CALL-7"

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
pyham_ax25==1.0.2