diff --git a/controller/SqliteNetworkController.cpp b/controller/SqliteNetworkController.cpp index 2cdd99135..9497ebc37 100644 --- a/controller/SqliteNetworkController.cpp +++ b/controller/SqliteNetworkController.cpp @@ -156,7 +156,7 @@ SqliteNetworkController::SqliteNetworkController(const char *dbPath) : if ( /* Network */ - (sqlite3_prepare_v2(_db,"SELECT name,private,enableBroadcast,allowPassiveBridging,v4AssignMode,v6AssignMode,multicastLimit,creationTime,revision,memberRevisionCounter FROM Network WHERE id = ?",-1,&_sGetNetworkById,(const char **)0) != SQLITE_OK) + (sqlite3_prepare_v2(_db,"SELECT name,private,enableBroadcast,allowPassiveBridging,v4AssignMode,v6AssignMode,multicastLimit,creationTime,revision,memberRevisionCounter,(SELECT COUNT(1) FROM Member WHERE Member.networkId = Network.id AND Member.authorized > 0) FROM Network WHERE id = ?",-1,&_sGetNetworkById,(const char **)0) != SQLITE_OK) ||(sqlite3_prepare_v2(_db,"SELECT revision FROM Network WHERE id = ?",-1,&_sGetNetworkRevision,(const char **)0) != SQLITE_OK) ||(sqlite3_prepare_v2(_db,"UPDATE Network SET revision = ? WHERE id = ?",-1,&_sSetNetworkRevision,(const char **)0) != SQLITE_OK) ||(sqlite3_prepare_v2(_db,"INSERT INTO Network (id,name,creationTime,revision) VALUES (?,?,?,1)",-1,&_sCreateNetwork,(const char **)0) != SQLITE_OK) @@ -1467,6 +1467,7 @@ unsigned int SqliteNetworkController::_doCPGet( "\t\"creationTime\": %llu,\n" "\t\"revision\": %llu,\n" "\t\"memberRevisionCounter\": %llu,\n" + "\t\"authorizedMemberCount\": %llu,\n" "\t\"relays\": [", nwids, _instanceId.c_str(), @@ -1479,7 +1480,8 @@ unsigned int SqliteNetworkController::_doCPGet( sqlite3_column_int(_sGetNetworkById,6), (unsigned long long)sqlite3_column_int64(_sGetNetworkById,7), (unsigned long long)sqlite3_column_int64(_sGetNetworkById,8), - (unsigned long long)sqlite3_column_int64(_sGetNetworkById,9)); + (unsigned long long)sqlite3_column_int64(_sGetNetworkById,9), + (unsigned long long)sqlite3_column_int64(_sGetNetworkById,10)); responseBody = json; sqlite3_reset(_sGetRelays); diff --git a/service/README.md b/service/README.md index 668aab056..3e52a8a1d 100644 --- a/service/README.md +++ b/service/README.md @@ -173,6 +173,7 @@ To create a new network with a random last six digits safely and atomically, you creationTimeintegerTime network was created in ms since epochno revisionintegerNetwork config revision numberno memberRevisionCounterintegerCurrent value of network revision counter (incremented after every member add or revision)no +authorizedMemberCountintegerNumber of authorized membersno relays[object]Array of network-specific relay nodes (see below)yes ipLocalRoutes[string]Array of IP network/netmask entries corresponding to networks routed directly via this interface (e.g. 10.0.0.0/8 to route 10.0.0.0 via this interface) ipAssignmentPools[object]Array of IP auto-assignment pools for 'zt' assignment modeyes