Skip to content

Commit 3da4eb2

Browse files
authored
REST -> RPC Migration (#84)
* migrate away from REST API for inter-dvmhost operations towards a custom UDP RPC framework; * replace config parameters for REST API in some places with properly named RPC; swap peer Network, FNE DiagNetwork and FNENetwork over from if-else-if ladders to switch statements (switch statements perform logically better after compilation because the compiler tends to optimize these into jump-tables which execute faster); * continued work on inter-dvmhost REST to RPC transition; * update build bumper for R04G20 to R04G21; * cleanup config file; * clean up doc/commenting;
1 parent 6b5c610 commit 3da4eb2

33 files changed

Lines changed: 2465 additions & 1430 deletions

configs/config.example.yml

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ log:
3636
# Network Configuration
3737
#
3838
network:
39+
#
40+
# FNE Configuration
41+
#
3942
# Flag indicating whether or not host networking is enabled.
4043
enable: true
4144
# Network Peer ID
@@ -77,6 +80,21 @@ network:
7780
# Flag indicating whether or not verbose debug logging is enabled.
7881
debug: false
7982

83+
#
84+
# RPC Configuration
85+
#
86+
# IP address of the network interface to listen for RPC calls on (or 0.0.0.0 for all).
87+
rpcAddress: 127.0.0.1
88+
# Port number for RPC calls to listen on.
89+
rpcPort: 9890
90+
# RPC access password.
91+
rpcPassword: "ULTRA-VERY-SECURE-DEFAULT"
92+
# Flag indicating whether or not verbose RPC debug logging is enabled.
93+
rpcDebug: false
94+
95+
#
96+
# REST API Configuration
97+
#
8098
# Flag indicating whether or not REST API is enabled.
8199
restEnable: false
82100
# IP address of the network interface to listen for REST API on (or 0.0.0.0 for all).
@@ -392,14 +410,12 @@ system:
392410
# These parameters should be left default for dedicated control channels.
393411
#
394412
controlCh:
395-
# REST API IP Address for control channel. (If blank, notifications are disabled.)
396-
restAddress:
397-
# REST API Port number for control channel. (If 0, notifications are disabled.)
398-
restPort: 0
399-
# REST API access password for control channel.
400-
restPassword: "PASSWORD"
401-
# Flag indicating whether or not REST API is operating in SSL mode.
402-
restSsl: false
413+
# RPC IP Address for control channel. (If blank, notifications are disabled.)
414+
rpcAddress: 127.0.0.1
415+
# RPC Port number for control channel. (If 0, notifications are disabled.)
416+
rpcPort: 0
417+
# RPC access password for control channel.
418+
rpcPassword: "ULTRA-VERY-SECURE-DEFAULT"
403419
# Flag indicating voice channels will notify the control channel of traffic status.
404420
notifyEnable: true
405421
# Amount of time between network presence announcements. (seconds)
@@ -414,14 +430,12 @@ system:
414430
- channelId: 2
415431
# Channel Number (used to calculate actual host frequency based on the identity table).
416432
channelNo: 1
417-
# REST API IP Address for voice channel.
418-
restAddress: 127.0.0.1
419-
# REST API Port number for voice channel.
420-
restPort: 9990
421-
# REST API access password for voice channel.
422-
restPassword: "PASSWORD"
423-
# Flag indicating whether or not REST API is operating in SSL mode.
424-
restSsl: false
433+
# RPC IP Address for voice channel.
434+
rpcAddress: 127.0.0.1
435+
# RPC Port number for voice channel.
436+
rpcPort: 9890
437+
# RPC access password for voice channel.
438+
rpcPassword: "ULTRA-VERY-SECURE-DEFAULT"
425439

426440
secure:
427441
# AES-128 16-byte Key (used for LLA)

src/common/Defines.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ typedef unsigned long long ulong64_t;
108108
#define __EXE_NAME__ ""
109109

110110
#define VERSION_MAJOR "04"
111-
#define VERSION_MINOR "20"
111+
#define VERSION_MINOR "21"
112112
#define VERSION_REV "G"
113113

114114
#define __NETVER__ "DVM_R" VERSION_MAJOR VERSION_REV VERSION_MINOR
@@ -153,6 +153,7 @@ typedef unsigned long long ulong64_t;
153153
const uint32_t REMOTE_MODEM_PORT = 3334;
154154
const uint32_t TRAFFIC_DEFAULT_PORT = 62031;
155155
const uint32_t REST_API_DEFAULT_PORT = 9990;
156+
const uint32_t RPC_DEFAULT_PORT = 9890;
156157

157158
/**
158159
* @brief Operational Host States

src/common/lookups/ChannelLookup.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ namespace lookups
6161
* @brief Initializes a new instance of the VoiceChData class.
6262
* @param chId Voice Channel Identity.
6363
* @param chNo Voice Channel Number.
64-
* @param address REST API Address.
65-
* @param port REST API Port.
66-
* @param password REST API Password.
64+
* @param address RPC/REST API Address.
65+
* @param port RPC/REST API Port.
66+
* @param password RPC/REST API Password.
6767
* @param ssl Flag indicating REST is using SSL.
6868
*/
69-
VoiceChData(uint8_t chId, uint32_t chNo, std::string address, uint16_t port, std::string password, bool ssl) :
69+
VoiceChData(uint8_t chId, uint32_t chNo, std::string address, uint16_t port, std::string password, bool ssl = false) :
7070
m_chId(chId),
7171
m_chNo(chNo),
7272
m_address(address),
@@ -116,15 +116,15 @@ namespace lookups
116116
*/
117117
__READONLY_PROPERTY_PLAIN(uint32_t, chNo);
118118
/**
119-
* @brief REST API Address.
119+
* @brief RPC/REST API Address.
120120
*/
121121
__PROPERTY_PLAIN(std::string, address);
122122
/**
123-
* @brief REST API Port.
123+
* @brief RPC/REST API Port.
124124
*/
125125
__PROPERTY_PLAIN(uint16_t, port);
126126
/**
127-
* @brief REST API Password.
127+
* @brief RPC/REST API Password.
128128
*/
129129
__READONLY_PROPERTY_PLAIN(std::string, password);
130130
/**

0 commit comments

Comments
 (0)