Browse Source

Automatic refactoring to get rid of dangerous usage of String_CONST()

Caleb James DeLisle 7 years ago
parent
commit
1881da934d

+ 12 - 13
admin/Admin.c

@@ -214,14 +214,14 @@ int Admin_sendMessage(Dict* message, String* txid, struct Admin* adminPub)
 
 static inline bool authValid(Dict* message, struct Message* messageBytes, struct Admin_pvt* admin)
 {
-    String* cookieStr = Dict_getString(message, String_CONST("cookie"));
+    String* cookieStr = Dict_getStringC(message, "cookie");
     uint32_t cookie = (cookieStr != NULL) ? strtoll(cookieStr->bytes, NULL, 10) : 0;
     if (!cookie) {
-        int64_t* cookieInt = Dict_getInt(message, String_CONST("cookie"));
+        int64_t* cookieInt = Dict_getIntC(message, "cookie");
         cookie = (cookieInt) ? *cookieInt : 0;
     }
     uint64_t nowSecs = Time_currentTimeSeconds(admin->eventBase);
-    String* submittedHash = Dict_getString(message, String_CONST("hash"));
+    String* submittedHash = Dict_getStringC(message, "hash");
     if (cookie >  nowSecs || cookie < nowSecs - 20 || !submittedHash || submittedHash->len != 64) {
         return false;
     }
@@ -258,10 +258,10 @@ static bool checkArgs(Dict* args,
         Assert_ifParanoid(entry->val->type == Object_DICT);
         Dict* value = entry->val->as.dictionary;
         entry = entry->next;
-        if (*Dict_getInt(value, String_CONST("required")) == 0) {
+        if (*Dict_getIntC(value, "required") == 0) {
             continue;
         }
-        String* type = Dict_getString(value, String_CONST("type"));
+        String* type = Dict_getStringC(value, "type");
         if ((type == STRING && !Dict_getString(args, key))
             || (type == DICT && !Dict_getDict(args, key))
             || (type == INTEGER && !Dict_getInt(args, key))
@@ -293,7 +293,7 @@ static void asyncEnabled(Dict* args, void* vAdmin, String* txid, struct Allocato
 static void availableFunctions(Dict* args, void* vAdmin, String* txid, struct Allocator* tempAlloc)
 {
     struct Admin_pvt* admin = Identity_check((struct Admin_pvt*) vAdmin);
-    int64_t* page = Dict_getInt(args, String_CONST("page"));
+    int64_t* page = Dict_getIntC(args, "page");
     uint32_t i = (page) ? *page * ENTRIES_PER_PAGE : 0;
 
     Dict* d = Dict_new(tempAlloc);
@@ -302,11 +302,10 @@ static void availableFunctions(Dict* args, void* vAdmin, String* txid, struct Al
     for (; i < (uint32_t)admin->functionCount && count++ < ENTRIES_PER_PAGE; i++) {
         Dict_putDict(functions, admin->functions[i].name, admin->functions[i].args, tempAlloc);
     }
-    String* more = String_CONST("more");
     if (count >= ENTRIES_PER_PAGE) {
-        Dict_putInt(d, more, 1, tempAlloc);
+        Dict_putIntC(d, "more", 1, tempAlloc);
     }
-    Dict_putDict(d, String_CONST("availableFunctions"), functions, tempAlloc);
+    Dict_putDictC(d, "availableFunctions", functions, tempAlloc);
 
     Admin_sendMessage(d, txid, &admin->pub);
 }
@@ -317,7 +316,7 @@ static void handleRequest(Dict* messageDict,
                           struct Allocator* allocator,
                           struct Admin_pvt* admin)
 {
-    String* query = Dict_getString(messageDict, String_CONST("q"));
+    String* query = Dict_getStringC(messageDict, "q");
     if (!query) {
         Log_info(admin->logger, "Got a non-query from admin interface");
         return;
@@ -351,11 +350,11 @@ static void handleRequest(Dict* messageDict,
     if (String_equals(query, auth)) {
         if (!authValid(messageDict, message, admin)) {
             Dict* d = Dict_new(allocator);
-            Dict_putString(d, String_CONST("error"), String_CONST("Auth failed."), allocator);
+            Dict_putStringC(d, "error", String_CONST("Auth failed."), allocator);
             Admin_sendMessage(d, txid, &admin->pub);
             return;
         }
-        query = Dict_getString(messageDict, String_CONST("aq"));
+        query = Dict_getStringC(messageDict, "aq");
         authed = true;
     }
 
@@ -377,7 +376,7 @@ static void handleRequest(Dict* messageDict,
         admin->asyncEnabled = 0;
     }
 
-    Dict* args = Dict_getDict(messageDict, String_CONST("args"));
+    Dict* args = Dict_getDictC(messageDict, "args");
     bool noFunctionsCalled = true;
     for (int i = 0; i < admin->functionCount; i++) {
         if (String_equals(query, admin->functions[i].name)

+ 9 - 9
admin/AdminLog.c

@@ -228,10 +228,10 @@ static void doLog(struct Log* genericLog,
 static void subscribe(Dict* args, void* vcontext, String* txid, struct Allocator* requestAlloc)
 {
     struct AdminLog* log = Identity_check((struct AdminLog*) vcontext);
-    String* levelName = Dict_getString(args, String_CONST("level"));
+    String* levelName = Dict_getStringC(args, "level");
     enum Log_Level level = (levelName) ? Log_levelForName(levelName->bytes) : Log_Level_DEBUG;
-    int64_t* lineNumPtr = Dict_getInt(args, String_CONST("line"));
-    String* fileStr = Dict_getString(args, String_CONST("file"));
+    int64_t* lineNumPtr = Dict_getIntC(args, "line");
+    String* fileStr = Dict_getStringC(args, "file");
     if (fileStr && !fileStr->len) { fileStr = NULL; }
     char* error = "2+2=5";
     if (level == Log_Level_INVALID) {
@@ -272,7 +272,7 @@ static void subscribe(Dict* args, void* vcontext, String* txid, struct Allocator
 static void unsubscribe(Dict* args, void* vcontext, String* txid, struct Allocator* requestAlloc)
 {
     struct AdminLog* log = Identity_check((struct AdminLog*) vcontext);
-    String* streamIdHex = Dict_getString(args, String_CONST("streamId"));
+    String* streamIdHex = Dict_getStringC(args, "streamId");
     uint8_t streamId[8];
     char* error = NULL;
     if (streamIdHex->len != 16 || Hex_decode(streamId, 8, (uint8_t*)streamIdHex->bytes, 16) != 8) {
@@ -297,7 +297,7 @@ static void unsubscribe(Dict* args, void* vcontext, String* txid, struct Allocat
 static void logMany(Dict* args, void* vcontext, String* txid, struct Allocator* alloc)
 {
     struct AdminLog* log = Identity_check((struct AdminLog*) vcontext);
-    int64_t* countPtr = Dict_getInt(args, String_CONST("count"));
+    int64_t* countPtr = Dict_getIntC(args, "count");
     uint32_t count = *countPtr;
     for (uint32_t i = 0; i < count; i++) {
         Log_debug((struct Log*)log, "This is message number [%d] of total [%d]", i, count);
@@ -314,7 +314,7 @@ static void subscriptions(Dict* args, void* vcontext, String* txid, struct Alloc
     struct AdminLog* log = Identity_check((struct AdminLog*) vcontext);
     Dict* msg = Dict_new(alloc);
     List* entries = List_new(alloc);
-    Dict_putList(msg, String_CONST("entries"), entries, alloc);
+    Dict_putListC(msg, "entries", entries, alloc);
     for (int i = 0; i < (int)log->subscriptionCount; i++) {
         Dict* entry = Dict_new(alloc);
         struct Subscription* sub = &log->subscriptions[i];
@@ -323,9 +323,9 @@ static void subscriptions(Dict* args, void* vcontext, String* txid, struct Alloc
             Dict_putString(entry, STR_FILE, String_new(sub->file, alloc), alloc);
         }
         Dict_putInt(entry, LINE, sub->lineNum, alloc);
-        Dict_putInt(entry, String_CONST("dropped"), sub->dropped, alloc);
-        Dict_putInt(entry, String_CONST("internalFile"), sub->internalFile, alloc);
-        Dict_putString(entry, String_CONST("streamId"), sub->streamId, alloc);
+        Dict_putIntC(entry, "dropped", sub->dropped, alloc);
+        Dict_putIntC(entry, "internalFile", sub->internalFile, alloc);
+        Dict_putStringC(entry, "streamId", sub->streamId, alloc);
         List_addDict(entries, entry, alloc);
     }
     Admin_sendMessage(msg, txid, log->admin);

+ 5 - 5
admin/AuthorizedPasswords.c

@@ -29,7 +29,7 @@ struct Context
 static void sendResponse(String* msg, struct Admin* admin, String* txid, struct Allocator* alloc)
 {
     Dict* output = Dict_new(alloc);
-    Dict_putString(output, String_CONST("error"), msg, alloc);
+    Dict_putStringC(output, "error", msg, alloc);
     Admin_sendMessage(output, txid, admin);
 }
 
@@ -37,9 +37,9 @@ static void add(Dict* args, void* vcontext, String* txid, struct Allocator* allo
 {
     struct Context* context = Identity_check((struct Context*) vcontext);
 
-    String* passwd = Dict_getString(args, String_CONST("password"));
-    String* user = Dict_getString(args, String_CONST("user"));
-    String* ipv6 = Dict_getString(args, String_CONST("ipv6"));
+    String* passwd = Dict_getStringC(args, "password");
+    String* user = Dict_getStringC(args, "user");
+    String* ipv6 = Dict_getStringC(args, "ipv6");
 
     uint8_t ipv6Bytes[16];
     uint8_t* ipv6Arg;
@@ -69,7 +69,7 @@ static void add(Dict* args, void* vcontext, String* txid, struct Allocator* allo
 static void remove(Dict* args, void* vcontext, String* txid, struct Allocator* requestAlloc)
 {
     struct Context* context = Identity_check((struct Context*) vcontext);
-    String* user = Dict_getString(args, String_CONST("user"));
+    String* user = Dict_getStringC(args, "user");
 
     int32_t ret = CryptoAuth_removeUsers(context->ca, user);
     if (ret) {

+ 10 - 10
admin/angel/Core.c

@@ -142,7 +142,7 @@ static void sendResponse(String* error,
                          struct Allocator* tempAlloc)
 {
     Dict* output = Dict_new(tempAlloc);
-    Dict_putString(output, String_CONST("error"), error, tempAlloc);
+    Dict_putStringC(output, "error", error, tempAlloc);
     Admin_sendMessage(output, txid, admin);
 }
 
@@ -177,8 +177,8 @@ static void initTunfd(Dict* args, void* vcontext, String* txid, struct Allocator
     struct Context* ctx = Identity_check((struct Context*) vcontext);
     struct Jmp jmp;
     Jmp_try(jmp) {
-        int64_t* tunfd = Dict_getInt(args, String_CONST("tunfd"));
-        int64_t* tuntype = Dict_getInt(args, String_CONST("type"));
+        int64_t* tunfd = Dict_getIntC(args, "tunfd");
+        int64_t* tuntype = Dict_getIntC(args, "type");
         if (!tunfd || *tunfd < 0) {
             String* error = String_printf(requestAlloc, "Invalid tunfd");
             sendResponse(error, ctx->admin, txid, requestAlloc);
@@ -209,7 +209,7 @@ static void initTunnel(Dict* args, void* vcontext, String* txid, struct Allocato
 
     struct Jmp jmp;
     Jmp_try(jmp) {
-        String* desiredName = Dict_getString(args, String_CONST("desiredTunName"));
+        String* desiredName = Dict_getStringC(args, "desiredTunName");
         initTunnel2(desiredName, ctx, 8, &jmp.handler);
     } Jmp_catch {
         String* error = String_printf(requestAlloc, "Failed to configure tunnel [%s]", jmp.message);
@@ -358,10 +358,10 @@ int Core_main(int argc, char** argv)
     Log_debug(logger, "Finished getting pre-configuration from client");
     Dict* config = BencMessageReader_read(preConf, tempAlloc, eh);
 
-    String* privateKeyHex = Dict_getString(config, String_CONST("privateKey"));
-    Dict* adminConf = Dict_getDict(config, String_CONST("admin"));
-    String* pass = Dict_getString(adminConf, String_CONST("pass"));
-    String* bind = Dict_getString(adminConf, String_CONST("bind"));
+    String* privateKeyHex = Dict_getStringC(config, "privateKey");
+    Dict* adminConf = Dict_getDictC(config, "admin");
+    String* pass = Dict_getStringC(adminConf, "pass");
+    String* bind = Dict_getStringC(adminConf, "bind");
     if (!(pass && privateKeyHex && bind)) {
         if (!pass) {
             Except_throw(eh, "Expected 'pass'");
@@ -394,8 +394,8 @@ int Core_main(int argc, char** argv)
     struct Admin* admin = Admin_new(&udpAdmin->generic, logger, eventBase, pass);
 
     // --------------------- Setup the Logger --------------------- //
-    Dict* logging = Dict_getDict(config, String_CONST("logging"));
-    String* logTo = Dict_getString(logging, String_CONST("logTo"));
+    Dict* logging = Dict_getDictC(config, "logging");
+    String* logTo = Dict_getStringC(logging, "logTo");
     if (logTo && String_equals(logTo, String_CONST("stdout"))) {
         // do nothing, continue logging to stdout.
     } else {

+ 3 - 3
client/AdminClient.c

@@ -136,7 +136,7 @@ static Iface_DEFUN receiveMessage(struct Message* msg, struct Iface* addrIface)
     if (err) { return NULL; }
     Message_shift(msg, origLen, NULL);
 
-    String* txid = Dict_getString(d, String_CONST("txid"));
+    String* txid = Dict_getStringC(d, "txid");
     if (!txid || txid->len != 8) { return NULL; }
 
     // look up the result
@@ -189,7 +189,7 @@ static struct Request* sendRaw(Dict* messageDict,
 
     String* id = String_newBinary(NULL, 8, req->alloc);
     Hex_encode(id->bytes, 8, (int8_t*) &req->handle, 4);
-    Dict_putString(messageDict, String_CONST("txid"), id, req->alloc);
+    Dict_putStringC(messageDict, "txid", id, req->alloc);
 
     if (cookie) {
         Assert_true(!calculateAuth(messageDict, ctx->password, cookie, req->alloc));
@@ -231,7 +231,7 @@ static void cookieCallback(struct Request* req)
         requestCallback(req);
         return;
     }
-    String* cookie = Dict_getString(req->res.responseDict, String_CONST("cookie"));
+    String* cookie = Dict_getStringC(req->res.responseDict, "cookie");
     if (!cookie) {
         req->res.err = AdminClient_Error_NO_COOKIE;
         requestCallback(req);

+ 80 - 80
client/Configurator.c

@@ -97,7 +97,7 @@ static int rpcCall0(String* function,
                       function->bytes);
         die(res, ctx, alloc);
     }
-    String* error = Dict_getString(res->responseDict, String_CONST("error"));
+    String* error = Dict_getStringC(res->responseDict, "error");
     int ret = 0;
     if (error && !String_equals(error, String_CONST("none"))) {
         if (exitIfError) {
@@ -137,7 +137,7 @@ static void authorizedPasswords(List* list, struct Context* ctx)
             Log_critical(ctx->logger, "Not a dictionary type %d.", i);
             exit(-1);
         }
-        String* passwd = Dict_getString(d, String_CONST("password"));
+        String* passwd = Dict_getStringC(d, "password");
         if (!passwd) {
             Log_critical(ctx->logger, "Must specify a password %d.", i);
             exit(-1);
@@ -147,28 +147,28 @@ static void authorizedPasswords(List* list, struct Context* ctx)
     for (uint32_t i = 0; i < count; i++) {
         struct Allocator* child = Allocator_child(ctx->alloc);
         Dict* d = List_getDict(list, i);
-        String* passwd = Dict_getString(d, String_CONST("password"));
-        String* user = Dict_getString(d, String_CONST("user"));
+        String* passwd = Dict_getStringC(d, "password");
+        String* user = Dict_getStringC(d, "user");
         String* displayName = user;
         if (!displayName) {
             displayName = String_printf(child, "password [%d]", i);
         }
-        //String* publicKey = Dict_getString(d, String_CONST("publicKey"));
-        String* ipv6 = Dict_getString(d, String_CONST("ipv6"));
+        //String* publicKey = Dict_getStringC(d, "publicKey");
+        String* ipv6 = Dict_getStringC(d, "ipv6");
         Log_info(ctx->logger, "Adding authorized password #[%d] for user [%s].",
             i, displayName->bytes);
         Dict *args = Dict_new(child);
         uint32_t i = 1;
-        Dict_putInt(args, String_CONST("authType"), i, child);
-        Dict_putString(args, String_CONST("password"), passwd, child);
+        Dict_putIntC(args, "authType", i, child);
+        Dict_putStringC(args, "password", passwd, child);
         if (user) {
-            Dict_putString(args, String_CONST("user"), user, child);
+            Dict_putStringC(args, "user", user, child);
         }
-        Dict_putString(args, String_CONST("displayName"), displayName, child);
+        Dict_putStringC(args, "displayName", displayName, child);
         if (ipv6) {
             Log_info(ctx->logger,
                 "  This connection password restricted to [%s] only.", ipv6->bytes);
-            Dict_putString(args, String_CONST("ipv6"), ipv6, child);
+            Dict_putStringC(args, "ipv6", ipv6, child);
         }
         rpcCall(String_CONST("AuthorizedPasswords_add"), args, ctx, child);
         Allocator_free(child);
@@ -177,10 +177,10 @@ static void authorizedPasswords(List* list, struct Context* ctx)
 
 static void udpInterface(Dict* config, struct Context* ctx)
 {
-    List* ifaces = Dict_getList(config, String_CONST("UDPInterface"));
+    List* ifaces = Dict_getListC(config, "UDPInterface");
     if (!ifaces) {
         ifaces = List_new(ctx->alloc);
-        List_addDict(ifaces, Dict_getDict(config, String_CONST("UDPInterface")), ctx->alloc);
+        List_addDict(ifaces, Dict_getDictC(config, "UDPInterface"), ctx->alloc);
     }
 
     uint32_t count = List_size(ifaces);
@@ -190,17 +190,17 @@ static void udpInterface(Dict* config, struct Context* ctx)
             continue;
         }
         // Setup the interface.
-        String* bindStr = Dict_getString(udp, String_CONST("bind"));
+        String* bindStr = Dict_getStringC(udp, "bind");
         Dict* d = Dict_new(ctx->alloc);
         if (bindStr) {
-            Dict_putString(d, String_CONST("bindAddress"), bindStr, ctx->alloc);
+            Dict_putStringC(d, "bindAddress", bindStr, ctx->alloc);
         }
         Dict* resp = NULL;
         rpcCall0(String_CONST("UDPInterface_new"), d, ctx, ctx->alloc, &resp, true);
-        int ifNum = *(Dict_getInt(resp, String_CONST("interfaceNumber")));
+        int ifNum = *(Dict_getIntC(resp, "interfaceNumber"));
 
         // Make the connections.
-        Dict* connectTo = Dict_getDict(udp, String_CONST("connectTo"));
+        Dict* connectTo = Dict_getDictC(udp, "connectTo");
         if (connectTo) {
             struct Dict_Entry* entry = *connectTo;
             struct Allocator* perCallAlloc = Allocator_child(ctx->alloc);
@@ -231,14 +231,14 @@ static void udpInterface(Dict* config, struct Context* ctx)
                                                 "[$IP]:$PORT for IPv6.", key->bytes);
                     exit(-1);
                 }
-                Dict_putInt(value, String_CONST("interfaceNumber"), ifNum, perCallAlloc);
-                Dict_putString(value, String_CONST("address"), key, perCallAlloc);
+                Dict_putIntC(value, "interfaceNumber", ifNum, perCallAlloc);
+                Dict_putStringC(value, "address", key, perCallAlloc);
                 rpcCall(String_CONST("UDPInterface_beginConnection"), value, ctx, perCallAlloc);
 
                 // Make a IPTunnel exception for this node
                 Dict* aed = Dict_new(perCallAlloc);
                 *lastColon = '\0';
-                Dict_putString(aed, String_CONST("route"), String_new(key->bytes, perCallAlloc),
+                Dict_putStringC(aed, "route", String_new(key->bytes, perCallAlloc),
                     perCallAlloc);
                 *lastColon = ':';
                 rpcCall(String_CONST("RouteGen_addException"), aed, ctx, perCallAlloc);
@@ -252,33 +252,33 @@ static void udpInterface(Dict* config, struct Context* ctx)
 
 static void tunInterface(Dict* ifaceConf, struct Allocator* tempAlloc, struct Context* ctx)
 {
-    String* ifaceType = Dict_getString(ifaceConf, String_CONST("type"));
+    String* ifaceType = Dict_getStringC(ifaceConf, "type");
     if (!String_equals(ifaceType, String_CONST("TUNInterface"))) {
         return;
     }
 
     // Setup the interface.
-    String* tunfd = Dict_getString(ifaceConf, String_CONST("tunfd"));
-    String* device = Dict_getString(ifaceConf, String_CONST("tunDevice"));
+    String* tunfd = Dict_getStringC(ifaceConf, "tunfd");
+    String* device = Dict_getStringC(ifaceConf, "tunDevice");
 
     Dict* args = Dict_new(tempAlloc);
     if (tunfd && device) {
-        Dict_putString(args, String_CONST("path"), device, tempAlloc);
-        Dict_putString(args, String_CONST("type"),
+        Dict_putStringC(args, "path", device, tempAlloc);
+        Dict_putStringC(args, "type",
                        String_new(tunfd->bytes, tempAlloc), tempAlloc);
         Dict* res = NULL;
         rpcCall0(String_CONST("FileNo_import"), args, ctx, tempAlloc, &res, false);
         if (res) {
             Dict* args = Dict_new(tempAlloc);
-            int64_t* tunfd = Dict_getInt(res, String_CONST("tunfd"));
-            int64_t* type = Dict_getInt(res, String_CONST("type"));
-            Dict_putInt(args, String_CONST("tunfd"), *tunfd, tempAlloc);
-            Dict_putInt(args, String_CONST("type"), *type, tempAlloc);
+            int64_t* tunfd = Dict_getIntC(res, "tunfd");
+            int64_t* type = Dict_getIntC(res, "type");
+            Dict_putIntC(args, "tunfd", *tunfd, tempAlloc);
+            Dict_putIntC(args, "type", *type, tempAlloc);
             rpcCall0(String_CONST("Core_initTunfd"), args, ctx, tempAlloc, NULL, false);
         }
     } else {
         if (device) {
-            Dict_putString(args, String_CONST("desiredTunName"), device, tempAlloc);
+            Dict_putStringC(args, "desiredTunName", device, tempAlloc);
         }
         rpcCall0(String_CONST("Core_initTunnel"), args, ctx, tempAlloc, NULL, false);
     }
@@ -286,17 +286,17 @@ static void tunInterface(Dict* ifaceConf, struct Allocator* tempAlloc, struct Co
 
 static void ipTunnel(Dict* ifaceConf, struct Allocator* tempAlloc, struct Context* ctx)
 {
-    List* incoming = Dict_getList(ifaceConf, String_CONST("allowedConnections"));
+    List* incoming = Dict_getListC(ifaceConf, "allowedConnections");
     if (incoming) {
         Dict* d;
         for (int i = 0; (d = List_getDict(incoming, i)) != NULL; i++) {
-            String* key = Dict_getString(d, String_CONST("publicKey"));
-            String* ip4 = Dict_getString(d, String_CONST("ip4Address"));
+            String* key = Dict_getStringC(d, "publicKey");
+            String* ip4 = Dict_getStringC(d, "ip4Address");
             // Note that the prefix length has to be a proper int in the config
             // (not quoted!)
-            int64_t* ip4Prefix = Dict_getInt(d, String_CONST("ip4Prefix"));
-            String* ip6 = Dict_getString(d, String_CONST("ip6Address"));
-            int64_t* ip6Prefix = Dict_getInt(d, String_CONST("ip6Prefix"));
+            int64_t* ip4Prefix = Dict_getIntC(d, "ip4Prefix");
+            String* ip6 = Dict_getStringC(d, "ip6Address");
+            int64_t* ip6Prefix = Dict_getIntC(d, "ip6Prefix");
             if (!key) {
                 Log_critical(ctx->logger, "In router.ipTunnel.allowedConnections[%d]"
                                           "'publicKey' required.", i);
@@ -337,12 +337,12 @@ static void ipTunnel(Dict* ifaceConf, struct Allocator* tempAlloc, struct Contex
                 }
             }
 
-            Dict_putString(d, String_CONST("publicKeyOfAuthorizedNode"), key, tempAlloc);
+            Dict_putStringC(d, "publicKeyOfAuthorizedNode", key, tempAlloc);
             rpcCall0(String_CONST("IpTunnel_allowConnection"), d, ctx, tempAlloc, NULL, true);
         }
     }
 
-    List* outgoing = Dict_getList(ifaceConf, String_CONST("outgoingConnections"));
+    List* outgoing = Dict_getListC(ifaceConf, "outgoingConnections");
     if (outgoing) {
         String* s;
         for (int i = 0; (s = List_getString(outgoing, i)) != NULL; i++) {
@@ -367,14 +367,14 @@ static void supernodes(List* supernodes, struct Allocator* tempAlloc, struct Con
 
 static void routerConfig(Dict* routerConf, struct Allocator* tempAlloc, struct Context* ctx)
 {
-    tunInterface(Dict_getDict(routerConf, String_CONST("interface")), tempAlloc, ctx);
-    ipTunnel(Dict_getDict(routerConf, String_CONST("ipTunnel")), tempAlloc, ctx);
-    supernodes(Dict_getList(routerConf, String_CONST("supernodes")), tempAlloc, ctx);
+    tunInterface(Dict_getDictC(routerConf, "interface"), tempAlloc, ctx);
+    ipTunnel(Dict_getDictC(routerConf, "ipTunnel"), tempAlloc, ctx);
+    supernodes(Dict_getListC(routerConf, "supernodes"), tempAlloc, ctx);
 }
 
 static void ethInterfaceSetBeacon(int ifNum, Dict* eth, struct Context* ctx)
 {
-    int64_t* beaconP = Dict_getInt(eth, String_CONST("beacon"));
+    int64_t* beaconP = Dict_getIntC(eth, "beacon");
     if (beaconP) {
         int64_t beacon = *beaconP;
         if (beacon > 3 || beacon < 0) {
@@ -391,10 +391,10 @@ static void ethInterfaceSetBeacon(int ifNum, Dict* eth, struct Context* ctx)
 
 static void ethInterface(Dict* config, struct Context* ctx)
 {
-    List* ifaces = Dict_getList(config, String_CONST("ETHInterface"));
+    List* ifaces = Dict_getListC(config, "ETHInterface");
     if (!ifaces) {
         ifaces = List_new(ctx->alloc);
-        List_addDict(ifaces, Dict_getDict(config, String_CONST("ETHInterface")), ctx->alloc);
+        List_addDict(ifaces, Dict_getDictC(config, "ETHInterface"), ctx->alloc);
     }
 
     uint32_t count = List_size(ifaces);
@@ -402,7 +402,7 @@ static void ethInterface(Dict* config, struct Context* ctx)
     for (uint32_t i = 0; i < count; i++) {
         Dict *eth = List_getDict(ifaces, i);
         if (!eth) { continue; }
-        String* deviceStr = Dict_getString(eth, String_CONST("bind"));
+        String* deviceStr = Dict_getStringC(eth, "bind");
         if (!deviceStr || !String_equals(String_CONST("all"), deviceStr)) { continue; }
         Log_info(ctx->logger, "Setting up all ETHInterfaces...");
         Dict* res = NULL;
@@ -411,21 +411,21 @@ static void ethInterface(Dict* config, struct Context* ctx)
             Log_info(ctx->logger, "Getting device list failed");
             break;
         }
-        List* devs = Dict_getList(res, String_CONST("devices"));
+        List* devs = Dict_getListC(res, "devices");
         uint32_t devCount = List_size(devs);
         for (uint32_t j = 0; j < devCount; j++) {
             Dict* d = Dict_new(ctx->alloc);
             String* deviceName = List_getString(devs, j);
             // skip loopback...
             if (String_equals(String_CONST("lo"), deviceName)) { continue; }
-            Dict_putString(d, String_CONST("bindDevice"), deviceName, ctx->alloc);
+            Dict_putStringC(d, "bindDevice", deviceName, ctx->alloc);
             Dict* resp;
             Log_info(ctx->logger, "Creating new ETHInterface [%s]", deviceName->bytes);
             if (rpcCall0(String_CONST("ETHInterface_new"), d, ctx, ctx->alloc, &resp, false)) {
                 Log_warn(ctx->logger, "Failed to create ETHInterface.");
                 continue;
             }
-            int ifNum = *(Dict_getInt(resp, String_CONST("interfaceNumber")));
+            int ifNum = *(Dict_getIntC(resp, "interfaceNumber"));
             ethInterfaceSetBeacon(ifNum, eth, ctx);
         }
         return;
@@ -435,23 +435,23 @@ static void ethInterface(Dict* config, struct Context* ctx)
         Dict *eth = List_getDict(ifaces, i);
         if (!eth) { continue; }
         // Setup the interface.
-        String* deviceStr = Dict_getString(eth, String_CONST("bind"));
+        String* deviceStr = Dict_getStringC(eth, "bind");
         Log_info(ctx->logger, "Setting up ETHInterface [%d].", i);
         Dict* d = Dict_new(ctx->alloc);
         if (deviceStr) {
             Log_info(ctx->logger, "Binding to device [%s].", deviceStr->bytes);
-            Dict_putString(d, String_CONST("bindDevice"), deviceStr, ctx->alloc);
+            Dict_putStringC(d, "bindDevice", deviceStr, ctx->alloc);
         }
         Dict* resp = NULL;
         if (rpcCall0(String_CONST("ETHInterface_new"), d, ctx, ctx->alloc, &resp, false)) {
             Log_warn(ctx->logger, "Failed to create ETHInterface.");
             continue;
         }
-        int ifNum = *(Dict_getInt(resp, String_CONST("interfaceNumber")));
+        int ifNum = *(Dict_getIntC(resp, "interfaceNumber"));
         ethInterfaceSetBeacon(ifNum, eth, ctx);
 
         // Make the connections.
-        Dict* connectTo = Dict_getDict(eth, String_CONST("connectTo"));
+        Dict* connectTo = Dict_getDictC(eth, "connectTo");
         if (connectTo) {
             Log_info(ctx->logger, "ETHInterface should connect to a specific node.");
             struct Dict_Entry* entry = *connectTo;
@@ -469,8 +469,8 @@ static void ethInterface(Dict* config, struct Context* ctx)
                 struct Allocator* perCallAlloc = Allocator_child(ctx->alloc);
                 // Turn the dict from the config into our RPC args dict by filling in all
                 // the arguments,
-                Dict_putString(value, String_CONST("macAddress"), key, perCallAlloc);
-                Dict_putInt(value, String_CONST("interfaceNumber"), ifNum, perCallAlloc);
+                Dict_putStringC(value, "macAddress", key, perCallAlloc);
+                Dict_putIntC(value, "interfaceNumber", ifNum, perCallAlloc);
                 rpcCall(String_CONST("ETHInterface_beginConnection"), value, ctx, perCallAlloc);
                 Allocator_free(perCallAlloc);
 
@@ -498,62 +498,62 @@ static void security(struct Allocator* tempAlloc, List* conf, struct Log* log, s
 
     do {
         Dict* d = Dict_new(tempAlloc);
-        Dict_putString(d, String_CONST("user"), String_CONST("nobody"), tempAlloc);
+        Dict_putStringC(d, "user", String_CONST("nobody"), tempAlloc);
         if (!Defined(win32)) {
             Dict* ret = NULL;
             rpcCall0(String_CONST("Security_getUser"), d, ctx, tempAlloc, &ret, true);
-            uid = *Dict_getInt(ret, String_CONST("uid"));
-            group = Dict_getInt(ret, String_CONST("gid"));
+            uid = *Dict_getIntC(ret, "uid");
+            group = Dict_getIntC(ret, "gid");
         }
     } while (0);
 
     for (int i = 0; conf && i < List_size(conf); i++) {
         Dict* elem = List_getDict(conf, i);
         String* s;
-        if (elem && (s = Dict_getString(elem, String_CONST("setuser")))) {
+        if (elem && (s = Dict_getStringC(elem, "setuser"))) {
             if (setuser == 0) { continue; }
             Dict* d = Dict_new(tempAlloc);
-            Dict_putString(d, String_CONST("user"), s, tempAlloc);
+            Dict_putStringC(d, "user", s, tempAlloc);
             Dict* ret = NULL;
             rpcCall0(String_CONST("Security_getUser"), d, ctx, tempAlloc, &ret, true);
-            uid = *Dict_getInt(ret, String_CONST("uid"));
-            group = Dict_getInt(ret, String_CONST("gid"));
-            int64_t* nka = Dict_getInt(elem, String_CONST("keepNetAdmin"));
-            int64_t* exemptAngel = Dict_getInt(elem, String_CONST("exemptAngel"));
+            uid = *Dict_getIntC(ret, "uid");
+            group = Dict_getIntC(ret, "gid");
+            int64_t* nka = Dict_getIntC(elem, "keepNetAdmin");
+            int64_t* exemptAngel = Dict_getIntC(elem, "exemptAngel");
             keepNetAdmin = ((nka) ? *nka : ((exemptAngel) ? *exemptAngel : 0));
             continue;
         }
-        if (elem && (s = Dict_getString(elem, String_CONST("chroot")))) {
+        if (elem && (s = Dict_getStringC(elem, "chroot"))) {
             Log_debug(log, "Security_chroot(%s)", s->bytes);
             Dict* d = Dict_new(tempAlloc);
-            Dict_putString(d, String_CONST("root"), s, tempAlloc);
+            Dict_putStringC(d, "root", s, tempAlloc);
             rpcCall0(String_CONST("Security_chroot"), d, ctx, tempAlloc, NULL, false);
             chroot = 0;
             continue;
         }
         uint64_t* x;
-        if (elem && (x = Dict_getInt(elem, String_CONST("nofiles")))) {
+        if (elem && (x = Dict_getIntC(elem, "nofiles"))) {
             if (!*x) { continue; }
             nofiles = 1;
             continue;
         }
-        if (elem && (x = Dict_getInt(elem, String_CONST("setuser")))) {
+        if (elem && (x = Dict_getIntC(elem, "setuser"))) {
             if (!*x) { setuser = 0; }
             continue;
         }
-        if (elem && (x = Dict_getInt(elem, String_CONST("seccomp")))) {
+        if (elem && (x = Dict_getIntC(elem, "seccomp"))) {
             if (!*x) { seccomp = 0; }
             continue;
         }
-        if (elem && (x = Dict_getInt(elem, String_CONST("noforks")))) {
+        if (elem && (x = Dict_getIntC(elem, "noforks"))) {
             if (!*x) { noforks = 0; }
             continue;
         }
-        if (elem && (x = Dict_getInt(elem, String_CONST("chroot")))) {
+        if (elem && (x = Dict_getIntC(elem, "chroot"))) {
             if (!*x) { chroot = 0; }
             continue;
         }
-        if (elem && (x = Dict_getInt(elem, String_CONST("setupComplete")))) {
+        if (elem && (x = Dict_getIntC(elem, "setupComplete"))) {
             if (!*x) { setupComplete = 0; }
             continue;
         }
@@ -563,7 +563,7 @@ static void security(struct Allocator* tempAlloc, List* conf, struct Log* log, s
     if (chroot) {
         Log_debug(log, "Security_chroot(/var/run)");
         Dict* d = Dict_new(tempAlloc);
-        Dict_putString(d, String_CONST("root"), String_CONST("/var/run/"), tempAlloc);
+        Dict_putStringC(d, "root", String_CONST("/var/run/"), tempAlloc);
         rpcCall0(String_CONST("Security_chroot"), d, ctx, tempAlloc, NULL, false);
     }
     /* FIXME(sdg): moving noforks after setuser might make nproc <- 0,0 work
@@ -576,11 +576,11 @@ static void security(struct Allocator* tempAlloc, List* conf, struct Log* log, s
     if (setuser) {
         Log_debug(log, "Security_setUser(uid:%d, keepNetAdmin:%d)", uid, keepNetAdmin);
         Dict* d = Dict_new(tempAlloc);
-        Dict_putInt(d, String_CONST("uid"), uid, tempAlloc);
+        Dict_putIntC(d, "uid", uid, tempAlloc);
         if (group) {
-            Dict_putInt(d, String_CONST("gid"), (int)*group, tempAlloc);
+            Dict_putIntC(d, "gid", (int)*group, tempAlloc);
         }
-        Dict_putInt(d, String_CONST("keepNetAdmin"), keepNetAdmin, tempAlloc);
+        Dict_putIntC(d, "keepNetAdmin", keepNetAdmin, tempAlloc);
         rpcCall0(String_CONST("Security_setUser"), d, ctx, tempAlloc, NULL, false);
     }
     if (nofiles) {
@@ -606,7 +606,7 @@ static int tryPing(struct Allocator* tempAlloc, struct Context* ctx)
     Dict* d = Dict_new(tempAlloc);
     rpcCall0(String_CONST("ping"), d, ctx, tempAlloc, &resp, false);
     if (!resp) { return -1; }
-    String* q = Dict_getString(resp, String_CONST("q"));
+    String* q = Dict_getStringC(resp, "q");
     if (String_equals(q, String_CONST("pong"))) {
         return true;
     }
@@ -660,22 +660,22 @@ void Configurator_config(Dict* config,
 
     waitUntilPong(&ctx);
 
-    List* authedPasswords = Dict_getList(config, String_CONST("authorizedPasswords"));
+    List* authedPasswords = Dict_getListC(config, "authorizedPasswords");
     if (authedPasswords) {
         authorizedPasswords(authedPasswords, &ctx);
     }
 
-    Dict* ifaces = Dict_getDict(config, String_CONST("interfaces"));
+    Dict* ifaces = Dict_getDictC(config, "interfaces");
     udpInterface(ifaces, &ctx);
 
     if (Defined(HAS_ETH_INTERFACE)) {
         ethInterface(ifaces, &ctx);
     }
 
-    Dict* routerConf = Dict_getDict(config, String_CONST("router"));
+    Dict* routerConf = Dict_getDictC(config, "router");
     routerConfig(routerConf, tempAlloc, &ctx);
 
-    List* secList = Dict_getList(config, String_CONST("security"));
+    List* secList = Dict_getListC(config, "security");
     security(tempAlloc, secList, logger, &ctx);
 
     Log_debug(logger, "Cjdns started in the background");

+ 14 - 14
client/cjdroute2.c

@@ -630,9 +630,9 @@ int main(int argc, char** argv)
     struct Log* logger = FileWriterLog_new(stdout, allocator);
 
     // --------------------- Get Admin  --------------------- //
-    Dict* configAdmin = Dict_getDict(&config, String_CONST("admin"));
-    String* adminPass = Dict_getString(configAdmin, String_CONST("password"));
-    String* adminBind = Dict_getString(configAdmin, String_CONST("bind"));
+    Dict* configAdmin = Dict_getDictC(&config, "admin");
+    String* adminPass = Dict_getStringC(configAdmin, "password");
+    String* adminBind = Dict_getStringC(configAdmin, "bind");
     if (!adminPass) {
         adminPass = String_newBinary(NULL, 32, allocator);
         Random_base32(rand, (uint8_t*) adminPass->bytes, 32);
@@ -655,7 +655,7 @@ int main(int argc, char** argv)
     struct Allocator* corePipeAlloc = Allocator_child(allocator);
     char corePipeName[64] = "client-core-";
     Random_base32(rand, (uint8_t*)corePipeName+CString_strlen(corePipeName), 31);
-    String* pipePath = Dict_getString(&config, String_CONST("pipe"));
+    String* pipePath = Dict_getStringC(&config, "pipe");
     if (!pipePath) {
         pipePath = String_CONST(Pipe_PATH);
     }
@@ -671,7 +671,7 @@ int main(int argc, char** argv)
     char* args[] = { "core", pipePath->bytes, corePipeName, NULL };
 
     // --------------------- Spawn Angel --------------------- //
-    String* privateKey = Dict_getString(&config, String_CONST("privateKey"));
+    String* privateKey = Dict_getStringC(&config, "privateKey");
 
     char* corePath = Process_getPath(allocator);
 
@@ -688,13 +688,13 @@ int main(int argc, char** argv)
     // --------------------- Pre-Configure Core ------------------------- //
     Dict* preConf = Dict_new(allocator);
     Dict* adminPreConf = Dict_new(allocator);
-    Dict_putDict(preConf, String_CONST("admin"), adminPreConf, allocator);
-    Dict_putString(preConf, String_CONST("privateKey"), privateKey, allocator);
-    Dict_putString(adminPreConf, String_CONST("bind"), adminBind, allocator);
-    Dict_putString(adminPreConf, String_CONST("pass"), adminPass, allocator);
-    Dict* logging = Dict_getDict(&config, String_CONST("logging"));
+    Dict_putDictC(preConf, "admin", adminPreConf, allocator);
+    Dict_putStringC(preConf, "privateKey", privateKey, allocator);
+    Dict_putStringC(adminPreConf, "bind", adminBind, allocator);
+    Dict_putStringC(adminPreConf, "pass", adminPass, allocator);
+    Dict* logging = Dict_getDictC(&config, "logging");
     if (logging) {
-        Dict_putDict(preConf, String_CONST("logging"), logging, allocator);
+        Dict_putDictC(preConf, "logging", logging, allocator);
     }
 
     struct Message* toCoreMsg = Message_new(0, 1024, allocator);
@@ -714,8 +714,8 @@ int main(int argc, char** argv)
     corePipe = NULL;
 
     // --------------------- Get Admin Addr/Port/Passwd --------------------- //
-    Dict* responseFromCoreAdmin = Dict_getDict(responseFromCore, String_CONST("admin"));
-    adminBind = Dict_getString(responseFromCoreAdmin, String_CONST("bind"));
+    Dict* responseFromCoreAdmin = Dict_getDictC(responseFromCore, "admin");
+    adminBind = Dict_getStringC(responseFromCoreAdmin, "bind");
 
     if (!adminBind) {
         Except_throw(eh, "didn't get address and port back from core");
@@ -738,7 +738,7 @@ int main(int argc, char** argv)
 
     // --------------------- noBackground ------------------------ //
 
-    int64_t* noBackground = Dict_getInt(&config, String_CONST("noBackground"));
+    int64_t* noBackground = Dict_getIntC(&config, "noBackground");
     if (forceNoBackground || (noBackground && *noBackground)) {
         Log_debug(logger, "Keeping cjdns client alive because %s",
             (forceNoBackground) ? "--nobg was specified on the command line"

+ 8 - 8
contrib/c/sybilsim.c

@@ -155,8 +155,8 @@ static void bindUDPCallback(struct RPCCall* call, struct AdminClient_Result* res
     // Indirection to shutup clang warning
     struct Log* logger = &call->node->nodeLog;
     Log_debug(logger, "UDPInterface_new() -> [%s]", res->messageBytes);
-    String* addr = Dict_getString(res->responseDict, String_CONST("bindAddress"));
-    int64_t* ifNum = Dict_getInt(res->responseDict, String_CONST("interfaceNumber"));
+    String* addr = Dict_getStringC(res->responseDict, "bindAddress");
+    int64_t* ifNum = Dict_getIntC(res->responseDict, "interfaceNumber");
     struct Sockaddr_storage ss;
     Assert_true(!Sockaddr_parse(addr->bytes, &ss));
     call->node->ifNum = *ifNum;
@@ -199,11 +199,11 @@ static struct NodeContext* startNode(char* nodeName,
     }));
     Identity_set(node);
 
-    node->bind = Dict_getString(admin, String_CONST("bind"));
+    node->bind = Dict_getStringC(admin, "bind");
     if (!node->bind) {
         node->bind = String_new("127.0.0.1:0", alloc);
     }
-    node->pass = Dict_getString(admin, String_CONST("password"));
+    node->pass = Dict_getStringC(admin, "password");
     if (!node->pass) {
         node->pass = String_new("x", alloc);
     }
@@ -386,18 +386,18 @@ static void letErRip(Dict* config, struct Allocator* alloc)
     struct Context* ctx = &sctx;
     Identity_set(ctx);
 
-    ctx->confNodes = Dict_getDict(config, String_CONST("nodes"));
+    ctx->confNodes = Dict_getDictC(config, "nodes");
 
     struct FakeNetwork* fakeNet = FakeNetwork_new(base, alloc, logger);
 
     String* key = NULL;
     Dict_forEach(ctx->confNodes, key) {
         Dict* val = Dict_getDict(ctx->confNodes, key);
-        String* privateKeyHex = Dict_getString(val, String_CONST("privateKey"));
-        Dict* admin = Dict_getDict(val, String_CONST("admin"));
+        String* privateKeyHex = Dict_getStringC(val, "privateKey");
+        Dict* admin = Dict_getDictC(val, "admin");
         struct NodeContext* nc =
             startNode(key->bytes, privateKeyHex->bytes, admin, ctx, eh, fakeNet);
-        nc->peers = Dict_getList(val, String_CONST("peers"));
+        nc->peers = Dict_getListC(val, "peers");
         Map_OfNodes_put(&key, &nc, &ctx->nodeMap);
     }
 

+ 6 - 6
dht/dhtcore/Janitor_admin.c

@@ -47,10 +47,10 @@ static void dumpRumorMill(Dict* args, void* vcontext, String* txid, struct Alloc
     struct Context* ctx = Identity_check((struct Context*) vcontext);
 
     Dict* out = Dict_new(requestAlloc);
-    struct RumorMill* rm = getRumorMill(ctx, Dict_getString(args, String_CONST("mill")));
+    struct RumorMill* rm = getRumorMill(ctx, Dict_getStringC(args, "mill"));
     if (!rm) {
-        Dict_putString(out,
-                       String_CONST("error"),
+        Dict_putStringC(out,
+                       "error",
                        String_CONST("mill must be one of "
                                     "[externalMill,linkMill,nodeMill,dhtMill,splitMill]"),
                        requestAlloc);
@@ -58,7 +58,7 @@ static void dumpRumorMill(Dict* args, void* vcontext, String* txid, struct Alloc
         return;
     }
 
-    int64_t* page = Dict_getInt(args, String_CONST("page"));
+    int64_t* page = Dict_getIntC(args, "page");
     int ctr = (page) ? *page * ENTRIES_PER_PAGE : 0;
 
     List* table = List_new(requestAlloc);
@@ -66,8 +66,8 @@ static void dumpRumorMill(Dict* args, void* vcontext, String* txid, struct Alloc
         String* addr = Address_toString(&rm->addresses[ctr++], requestAlloc);
         List_addString(table, addr, requestAlloc);
     }
-    Dict_putList(out, String_CONST("addresses"), table, requestAlloc);
-    Dict_putInt(out, String_CONST("total"), rm->count, requestAlloc);
+    Dict_putListC(out, "addresses", table, requestAlloc);
+    Dict_putIntC(out, "total", rm->count, requestAlloc);
     Admin_sendMessage(out, txid, ctx->admin);
 }
 

+ 22 - 22
dht/dhtcore/NodeStore_admin.c

@@ -37,7 +37,7 @@ struct Context {
 static void dumpTable(Dict* args, void* vcontext, String* txid, struct Allocator* requestAlloc)
 {
     struct Context* ctx = Identity_check((struct Context*) vcontext);
-    int64_t* page = Dict_getInt(args, String_CONST("page"));
+    int64_t* page = Dict_getIntC(args, "page");
     int ctr = (page) ? *page * ENTRIES_PER_PAGE : 0;
 
     Dict* out = Dict_new(requestAlloc);
@@ -51,39 +51,39 @@ static void dumpTable(Dict* args, void* vcontext, String* txid, struct Allocator
 
         String* ip = String_newBinary(NULL, 39, requestAlloc);
         Address_printIp(ip->bytes, &nn->address);
-        Dict_putString(nodeDict, String_CONST("ip"), ip, requestAlloc);
+        Dict_putStringC(nodeDict, "ip", ip, requestAlloc);
 
         String* addr = Address_toString(&nn->address, requestAlloc);
-        Dict_putString(nodeDict, String_CONST("addr"), addr, requestAlloc);
+        Dict_putStringC(nodeDict, "addr", addr, requestAlloc);
 
         String* path = String_newBinary(NULL, 19, requestAlloc);
         AddrTools_printPath(path->bytes, nn->address.path);
-        Dict_putString(nodeDict, String_CONST("path"), path, requestAlloc);
+        Dict_putStringC(nodeDict, "path", path, requestAlloc);
 
-        Dict_putInt(nodeDict, String_CONST("link"), Node_getCost(nn), requestAlloc);
-        Dict_putInt(nodeDict, String_CONST("version"), nn->address.protocolVersion, requestAlloc);
+        Dict_putIntC(nodeDict, "link", Node_getCost(nn), requestAlloc);
+        Dict_putIntC(nodeDict, "version", nn->address.protocolVersion, requestAlloc);
 
-        Dict_putInt(nodeDict,
-                    String_CONST("time"),
+        Dict_putIntC(nodeDict,
+                    "time",
                     NodeStore_timeSinceLastPing(ctx->store, nn),
                     requestAlloc);
 
-        Dict_putInt(nodeDict,
-                    String_CONST("bucket"),
+        Dict_putIntC(nodeDict,
+                    "bucket",
                     NodeStore_bucketForAddr(ctx->store->selfAddress, &nn->address),
                     requestAlloc);
 
         List_addDict(table, nodeDict, requestAlloc);
     }
-    Dict_putList(out, String_CONST("routingTable"), table, requestAlloc);
+    Dict_putListC(out, "routingTable", table, requestAlloc);
 
     if (nn) {
-        Dict_putInt(out, String_CONST("more"), 1, requestAlloc);
+        Dict_putIntC(out, "more", 1, requestAlloc);
     }
-    Dict_putInt(out, String_CONST("count"), ctx->store->nodeCount, requestAlloc);
-    Dict_putInt(out, String_CONST("peers"), ctx->store->peerCount, requestAlloc);
+    Dict_putIntC(out, "count", ctx->store->nodeCount, requestAlloc);
+    Dict_putIntC(out, "peers", ctx->store->peerCount, requestAlloc);
 
-    Dict_putString(out, String_CONST("deprecation"),
+    Dict_putStringC(out, "deprecation",
         String_CONST("ip,path,version will soon be removed"), requestAlloc);
 
     Admin_sendMessage(out, txid, ctx->admin);
@@ -237,20 +237,20 @@ static void nodeForAddr(Dict* args, void* vcontext, String* txid, struct Allocat
     Dict* bestParent = Dict_new(alloc);
     String* parentIp = String_newBinary(NULL, 39, alloc);
     AddrTools_printIp(parentIp->bytes, Node_getBestParent(node)->parent->address.ip6.bytes);
-    Dict_putString(bestParent, String_CONST("ip"), parentIp, alloc);
+    Dict_putStringC(bestParent, "ip", parentIp, alloc);
 
     String* parentChildLabel = String_newBinary(NULL, 19, alloc);
     AddrTools_printPath(parentChildLabel->bytes, Node_getBestParent(node)->cannonicalLabel);
-    Dict_putString(bestParent, String_CONST("parentChildLabel"), parentChildLabel, alloc);
+    Dict_putStringC(bestParent, "parentChildLabel", parentChildLabel, alloc);
 
     int isOneHop = Node_isOneHopLink(Node_getBestParent(node));
-    Dict_putInt(bestParent, String_CONST("isOneHop"), isOneHop, alloc);
+    Dict_putIntC(bestParent, "isOneHop", isOneHop, alloc);
 
-    Dict_putDict(result, String_CONST("bestParent"), bestParent, alloc);
+    Dict_putDictC(result, "bestParent", bestParent, alloc);
 
     String* bestLabel = String_newBinary(NULL, 19, alloc);
     AddrTools_printPath(bestLabel->bytes, node->address.path);
-    Dict_putString(result, String_CONST("routeLabel"), bestLabel, alloc);
+    Dict_putStringC(result, "routeLabel", bestLabel, alloc);
 
     Admin_sendMessage(ret, txid, ctx->admin);
 }
@@ -261,13 +261,13 @@ static void getRouteLabel(Dict* args, void* vcontext, String* txid, struct Alloc
 
     char* err = NULL;
 
-    String* pathToParentS = Dict_getString(args, String_CONST("pathToParent"));
+    String* pathToParentS = Dict_getStringC(args, "pathToParent");
     uint64_t pathToParent = 0;
     if (pathToParentS->len != 19 || AddrTools_parsePath(&pathToParent, pathToParentS->bytes)) {
         err = "parse_pathToParent";
     }
 
-    String* pathParentToChildS = Dict_getString(args, String_CONST("pathParentToChild"));
+    String* pathParentToChildS = Dict_getStringC(args, "pathParentToChild");
     uint64_t pathParentToChild = 0;
     if (pathParentToChildS->len != 19
         || AddrTools_parsePath(&pathParentToChild, pathParentToChildS->bytes))

+ 23 - 23
dht/dhtcore/RouterModule_admin.c

@@ -38,7 +38,7 @@ struct Context {
 static void lookup(Dict* args, void* vcontext, String* txid, struct Allocator* requestAlloc)
 {
     struct Context* ctx = vcontext;
-    String* addrStr = Dict_getString(args, String_CONST("address"));
+    String* addrStr = Dict_getStringC(args, "address");
     char* err = NULL;
     uint8_t addr[16];
     uint8_t resultBuff[60];
@@ -85,30 +85,30 @@ static void pingResponse(struct RouterModule_Promise* promise,
     if (versionBin && versionBin->len == 20) {
         String* versionStr = String_newBinary(NULL, 40, tempAlloc);
         Hex_encode(versionStr->bytes, 40, versionBin->bytes, 20);
-        Dict_putString(resp, String_CONST("version"), versionStr, tempAlloc);
+        Dict_putStringC(resp, "version", versionStr, tempAlloc);
     } else {
-        Dict_putString(resp, String_CONST("version"), String_CONST("unknown"), tempAlloc);
+        Dict_putStringC(resp, "version", String_CONST("unknown"), tempAlloc);
     }
 
     String* result = (responseDict) ? String_CONST("pong") : String_CONST("timeout");
-    Dict_putString(resp, String_CONST("result"), result, tempAlloc);
+    Dict_putStringC(resp, "result", result, tempAlloc);
 
     int64_t* protocolVersion = Dict_getInt(responseDict, CJDHTConstants_PROTOCOL);
     if (protocolVersion) {
-        Dict_putInt(resp, String_CONST("protocol"), *protocolVersion, tempAlloc);
+        Dict_putIntC(resp, "protocol", *protocolVersion, tempAlloc);
     }
 
-    Dict_putInt(resp, String_CONST("ms"), lag, tempAlloc);
+    Dict_putIntC(resp, "ms", lag, tempAlloc);
 
     if (from) {
         uint8_t fromStr[60] = "";
         Address_print(fromStr, from);
-        Dict_putString(resp, String_CONST("from"), String_new(fromStr, tempAlloc), tempAlloc);
+        Dict_putStringC(resp, "from", String_new(fromStr, tempAlloc), tempAlloc);
         String* addr = Address_toString(from, tempAlloc);
-        Dict_putString(resp, String_CONST("addr"), addr, tempAlloc);
+        Dict_putStringC(resp, "addr", addr, tempAlloc);
     }
 
-    Dict_putString(resp, String_CONST("deprecation"),
+    Dict_putStringC(resp, "deprecation",
         String_CONST("from,protocol,version will soon be removed"), tempAlloc);
 
     Admin_sendMessage(resp, ping->txid, ping->ctx->admin);
@@ -124,7 +124,7 @@ static void genericResponse(struct RouterModule_Promise* promise,
     struct Ping* ping = Identity_check((struct Ping*)promise->userData);
     Dict* out = Dict_new(promise->alloc);
     String* result = (responseDict) ? name : String_CONST("timeout");
-    Dict_putString(out, String_CONST("result"), result, promise->alloc);
+    Dict_putStringC(out, "result", result, promise->alloc);
 
     if (responseDict) {
         struct Address_List* addrs =
@@ -149,9 +149,9 @@ static void genericResponse(struct RouterModule_Promise* promise,
         }
     }
 
-    Dict_putInt(out, String_CONST("ms"), lag, promise->alloc);
+    Dict_putIntC(out, "ms", lag, promise->alloc);
 
-    Dict_putString(out, String_CONST("error"), String_CONST("none"), promise->alloc);
+    Dict_putStringC(out, "error", String_CONST("none"), promise->alloc);
 
     Admin_sendMessage(out, ping->txid, ping->ctx->admin);
 }
@@ -208,8 +208,8 @@ static struct Address* getNode(String* pathStr,
 static void pingNode(Dict* args, void* vctx, String* txid, struct Allocator* requestAlloc)
 {
     struct Context* ctx = Identity_check((struct Context*) vctx);
-    String* pathStr = Dict_getString(args, String_CONST("path"));
-    int64_t* timeoutPtr = Dict_getInt(args, String_CONST("timeout"));
+    String* pathStr = Dict_getStringC(args, "path");
+    int64_t* timeoutPtr = Dict_getIntC(args, "timeout");
     uint32_t timeout = (timeoutPtr && *timeoutPtr > 0) ? *timeoutPtr : 0;
 
     char* err = NULL;
@@ -235,9 +235,9 @@ static void pingNode(Dict* args, void* vctx, String* txid, struct Allocator* req
 static void getPeers(Dict* args, void* vctx, String* txid, struct Allocator* requestAlloc)
 {
     struct Context* ctx = Identity_check((struct Context*) vctx);
-    String* nearbyLabelStr = Dict_getString(args, String_CONST("nearbyPath"));
-    String* pathStr = Dict_getString(args, String_CONST("path"));
-    int64_t* timeoutPtr = Dict_getInt(args, String_CONST("timeout"));
+    String* nearbyLabelStr = Dict_getStringC(args, "nearbyPath");
+    String* pathStr = Dict_getStringC(args, "path");
+    int64_t* timeoutPtr = Dict_getIntC(args, "timeout");
     uint32_t timeout = (timeoutPtr && *timeoutPtr > 0) ? *timeoutPtr : 0;
 
     char* err = NULL;
@@ -271,9 +271,9 @@ static void getPeers(Dict* args, void* vctx, String* txid, struct Allocator* req
 static void findNode(Dict* args, void* vctx, String* txid, struct Allocator* requestAlloc)
 {
     struct Context* ctx = Identity_check((struct Context*) vctx);
-    String* nodeToQueryStr = Dict_getString(args, String_CONST("nodeToQuery"));
-    String* targetStr = Dict_getString(args, String_CONST("target"));
-    int64_t* timeoutPtr = Dict_getInt(args, String_CONST("timeout"));
+    String* nodeToQueryStr = Dict_getStringC(args, "nodeToQuery");
+    String* targetStr = Dict_getStringC(args, "target");
+    int64_t* timeoutPtr = Dict_getIntC(args, "timeout");
     uint32_t timeout = (timeoutPtr && *timeoutPtr > 0) ? *timeoutPtr : 0;
 
     char* err = NULL;
@@ -307,9 +307,9 @@ static void findNode(Dict* args, void* vctx, String* txid, struct Allocator* req
 static void nextHop(Dict* args, void* vctx, String* txid, struct Allocator* requestAlloc)
 {
     struct Context* ctx = Identity_check((struct Context*) vctx);
-    String* nodeToQueryStr = Dict_getString(args, String_CONST("nodeToQuery"));
-    String* targetStr = Dict_getString(args, String_CONST("target"));
-    int64_t* timeoutPtr = Dict_getInt(args, String_CONST("timeout"));
+    String* nodeToQueryStr = Dict_getStringC(args, "nodeToQuery");
+    String* targetStr = Dict_getStringC(args, "target");
+    int64_t* timeoutPtr = Dict_getIntC(args, "timeout");
     uint32_t timeout = (timeoutPtr && *timeoutPtr > 0) ? *timeoutPtr : 0;
 
     char* err = NULL;

+ 10 - 10
dht/dhtcore/SearchRunner_admin.c

@@ -33,7 +33,7 @@ struct Context {
 static void showActiveSearch(Dict* args, void* vctx, String* txid, struct Allocator* alloc)
 {
     struct Context* ctx = Identity_check((struct Context*) vctx);
-    int number = *(Dict_getInt(args, String_CONST("number")));
+    int number = *(Dict_getIntC(args, "number"));
 
     struct SearchRunner_SearchData* search =
         SearchRunner_showActiveSearch(ctx->runner, number, alloc);
@@ -81,17 +81,17 @@ static void searchResponse(struct RouterModule_Promise* promise,
 
     Dict* resp = Dict_new(alloc);
     if (!from) {
-        Dict_putString(resp, String_CONST("error"), String_CONST("none"), alloc);
-        Dict_putInt(resp, String_CONST("complete"), 1, alloc);
+        Dict_putStringC(resp, "error", String_CONST("none"), alloc);
+        Dict_putIntC(resp, "complete", 1, alloc);
         Admin_sendMessage(resp, search->txid, search->ctx->admin);
         Allocator_free(alloc);
         return;
     }
 
     String* fromStr = Address_toString(from, alloc);
-    Dict_putString(resp, String_CONST("from"), fromStr, alloc);
+    Dict_putStringC(resp, "from", fromStr, alloc);
 
-    Dict_putInt(resp, String_CONST("ms"), lag, alloc);
+    Dict_putIntC(resp, "ms", lag, alloc);
 
     struct Address_List* addrs = ReplySerializer_parse(from, responseDict, NULL, true, alloc);
     List* nodes = List_new(alloc);
@@ -99,7 +99,7 @@ static void searchResponse(struct RouterModule_Promise* promise,
         String* addr = Address_toString(&addrs->elems[i], alloc);
         List_addString(nodes, addr, alloc);
     }
-    Dict_putList(resp, String_CONST("nodes"), nodes, alloc);
+    Dict_putListC(resp, "nodes", nodes, alloc);
 
     Admin_sendMessage(resp, search->txid, search->ctx->admin);
 }
@@ -107,16 +107,16 @@ static void searchResponse(struct RouterModule_Promise* promise,
 static void search(Dict* args, void* vctx, String* txid, struct Allocator* reqAlloc)
 {
     struct Context* ctx = Identity_check((struct Context*) vctx);
-    String* addrStr = Dict_getString(args, String_CONST("ipv6"));
+    String* addrStr = Dict_getStringC(args, "ipv6");
 
     int maxRequests = -1;
-    uint64_t* maxRequestsPtr = Dict_getInt(args, String_CONST("maxRequests"));
+    uint64_t* maxRequestsPtr = Dict_getIntC(args, "maxRequests");
     if (maxRequestsPtr) { maxRequests = *maxRequestsPtr; }
 
     uint8_t addr[16];
     if (AddrTools_parseIp(addr, (uint8_t*) addrStr->bytes)) {
         Dict* resp = Dict_new(reqAlloc);
-        Dict_putString(resp, String_CONST("error"), String_CONST("ipv6 invalid"), reqAlloc);
+        Dict_putStringC(resp, "error", String_CONST("ipv6 invalid"), reqAlloc);
         Admin_sendMessage(resp, txid, ctx->admin);
     } else {
         struct Allocator* alloc = Allocator_child(ctx->allocator);
@@ -129,7 +129,7 @@ static void search(Dict* args, void* vctx, String* txid, struct Allocator* reqAl
 
         if (!s->promise) {
             Dict* resp = Dict_new(reqAlloc);
-            Dict_putString(resp, String_CONST("error"), String_CONST("creating search"), reqAlloc);
+            Dict_putStringC(resp, "error", String_CONST("creating search"), reqAlloc);
             Admin_sendMessage(resp, txid, ctx->admin);
             Allocator_free(alloc);
             return;

+ 17 - 17
interface/ETHInterface_admin.c

@@ -40,13 +40,13 @@ static void beginConnection(Dict* args,
 {
     struct Context* ctx = Identity_check((struct Context*) vcontext);
 
-    String* password = Dict_getString(args, String_CONST("password"));
-    String* login = Dict_getString(args, String_CONST("login"));
-    String* publicKey = Dict_getString(args, String_CONST("publicKey"));
-    String* macAddress = Dict_getString(args, String_CONST("macAddress"));
-    int64_t* interfaceNumber = Dict_getInt(args, String_CONST("interfaceNumber"));
+    String* password = Dict_getStringC(args, "password");
+    String* login = Dict_getStringC(args, "login");
+    String* publicKey = Dict_getStringC(args, "publicKey");
+    String* macAddress = Dict_getStringC(args, "macAddress");
+    int64_t* interfaceNumber = Dict_getIntC(args, "interfaceNumber");
     uint32_t ifNum = (interfaceNumber) ? ((uint32_t) *interfaceNumber) : 0;
-    String* peerName = Dict_getString(args, String_CONST("peerName"));
+    String* peerName = Dict_getStringC(args, "peerName");
     char* error = "none";
 
     uint8_t pkBytes[32];
@@ -77,14 +77,14 @@ static void beginConnection(Dict* args,
     }
 
     Dict* out = Dict_new(requestAlloc);
-    Dict_putString(out, String_CONST("error"), String_new(error, requestAlloc), requestAlloc);
+    Dict_putStringC(out, "error", String_new(error, requestAlloc), requestAlloc);
     Admin_sendMessage(out, txid, ctx->admin);
 }
 
 static void newInterface(Dict* args, void* vcontext, String* txid, struct Allocator* requestAlloc)
 {
     struct Context* const ctx = Identity_check((struct Context*) vcontext);
-    String* const bindDevice = Dict_getString(args, String_CONST("bindDevice"));
+    String* const bindDevice = Dict_getStringC(args, "bindDevice");
     struct Allocator* const alloc = Allocator_child(ctx->alloc);
 
     struct ETHInterface* ethIf = NULL;
@@ -94,7 +94,7 @@ static void newInterface(Dict* args, void* vcontext, String* txid, struct Alloca
             ctx->eventBase, bindDevice->bytes, alloc, &jmp.handler, ctx->logger);
     } Jmp_catch {
         Dict* out = Dict_new(requestAlloc);
-        Dict_putString(out, String_CONST("error"), String_CONST(jmp.message), requestAlloc);
+        Dict_putStringC(out, "error", String_CONST(jmp.message), requestAlloc);
         Admin_sendMessage(out, txid, ctx->admin);
         Allocator_free(alloc);
         return;
@@ -106,16 +106,16 @@ static void newInterface(Dict* args, void* vcontext, String* txid, struct Alloca
     Iface_plumb(&ici->addrIf, &ethIf->generic.iface);
 
     Dict* out = Dict_new(requestAlloc);
-    Dict_putString(out, String_CONST("error"), String_CONST("none"), requestAlloc);
-    Dict_putInt(out, String_CONST("interfaceNumber"), ici->ifNum, requestAlloc);
+    Dict_putStringC(out, "error", String_CONST("none"), requestAlloc);
+    Dict_putIntC(out, "interfaceNumber", ici->ifNum, requestAlloc);
 
     Admin_sendMessage(out, txid, ctx->admin);
 }
 
 static void beacon(Dict* args, void* vcontext, String* txid, struct Allocator* requestAlloc)
 {
-    int64_t* stateP = Dict_getInt(args, String_CONST("state"));
-    int64_t* ifNumP = Dict_getInt(args, String_CONST("interfaceNumber"));
+    int64_t* stateP = Dict_getIntC(args, "state");
+    int64_t* ifNumP = Dict_getIntC(args, "interfaceNumber");
     uint32_t ifNum = (ifNumP) ? ((uint32_t) *ifNumP) : 0;
     uint32_t state = (stateP) ? ((uint32_t) *stateP) : 0xffffffff;
     struct Context* ctx = Identity_check((struct Context*) vcontext);
@@ -132,7 +132,7 @@ static void beacon(Dict* args, void* vcontext, String* txid, struct Allocator* r
 
     if (error) {
         Dict* out = Dict_new(requestAlloc);
-        Dict_putString(out, String_CONST("error"), String_CONST(error), requestAlloc);
+        Dict_putStringC(out, "error", String_CONST(error), requestAlloc);
         Admin_sendMessage(out, txid, ctx->admin);
         return;
     }
@@ -161,14 +161,14 @@ static void listDevices(Dict* args, void* vcontext, String* txid, struct Allocat
         devices = ETHInterface_listDevices(requestAlloc, &jmp.handler);
     } Jmp_catch {
         Dict* out = Dict_new(requestAlloc);
-        Dict_putString(out, String_CONST("error"), String_CONST(jmp.message), requestAlloc);
+        Dict_putStringC(out, "error", String_CONST(jmp.message), requestAlloc);
         Admin_sendMessage(out, txid, ctx->admin);
         return;
     }
 
     Dict* out = Dict_new(requestAlloc);
-    Dict_putString(out, String_CONST("error"), String_CONST("none"), requestAlloc);
-    Dict_putList(out, String_CONST("devices"), devices, requestAlloc);
+    Dict_putStringC(out, "error", String_CONST("none"), requestAlloc);
+    Dict_putListC(out, "devices", devices, requestAlloc);
     Admin_sendMessage(out, txid, ctx->admin);
 }
 

+ 11 - 11
interface/UDPInterface_admin.c

@@ -41,13 +41,13 @@ static void beginConnection(Dict* args,
 {
     struct Context* ctx = vcontext;
 
-    String* password = Dict_getString(args, String_CONST("password"));
-    String* login = Dict_getString(args, String_CONST("login"));
-    String* publicKey = Dict_getString(args, String_CONST("publicKey"));
-    String* address = Dict_getString(args, String_CONST("address"));
-    int64_t* interfaceNumber = Dict_getInt(args, String_CONST("interfaceNumber"));
+    String* password = Dict_getStringC(args, "password");
+    String* login = Dict_getStringC(args, "login");
+    String* publicKey = Dict_getStringC(args, "publicKey");
+    String* address = Dict_getStringC(args, "address");
+    int64_t* interfaceNumber = Dict_getIntC(args, "interfaceNumber");
     uint32_t ifNum = (interfaceNumber) ? ((uint32_t) *interfaceNumber) : 0;
-    String* peerName = Dict_getString(args, String_CONST("peerName"));
+    String* peerName = Dict_getStringC(args, "peerName");
     String* error = NULL;
 
     Log_debug(ctx->logger, "Peering with [%s]", publicKey->bytes);
@@ -164,11 +164,11 @@ static void newInterface2(struct Context* ctx,
     Iface_plumb(&ici->addrIf, &ai->iface);
 
     Dict* out = Dict_new(requestAlloc);
-    Dict_putString(out, String_CONST("error"), String_CONST("none"), requestAlloc);
-    Dict_putInt(out, String_CONST("interfaceNumber"), ici->ifNum, requestAlloc);
+    Dict_putStringC(out, "error", String_CONST("none"), requestAlloc);
+    Dict_putIntC(out, "interfaceNumber", ici->ifNum, requestAlloc);
     char* printedAddr = Sockaddr_print(ai->addr, requestAlloc);
-    Dict_putString(out,
-                   String_CONST("bindAddress"),
+    Dict_putStringC(out,
+                   "bindAddress",
                    String_CONST(printedAddr),
                    requestAlloc);
 
@@ -178,7 +178,7 @@ static void newInterface2(struct Context* ctx,
 static void newInterface(Dict* args, void* vcontext, String* txid, struct Allocator* requestAlloc)
 {
     struct Context* ctx = vcontext;
-    String* bindAddress = Dict_getString(args, String_CONST("bindAddress"));
+    String* bindAddress = Dict_getStringC(args, "bindAddress");
     struct Sockaddr_storage addr;
     if (Sockaddr_parse((bindAddress) ? bindAddress->bytes : "0.0.0.0", &addr)) {
         Dict out = Dict_CONST(

+ 2 - 2
memory/Allocator_admin.c

@@ -28,7 +28,7 @@ struct Allocator_admin_pvt
 static void snapshot(Dict* args, void* vcontext, String* txid, struct Allocator* requestAlloc)
 {
     struct Allocator_admin_pvt* ctx = Identity_check((struct Allocator_admin_pvt*)vcontext);
-    uint64_t* includeAllocations = Dict_getInt(args, String_CONST("includeAllocations"));
+    uint64_t* includeAllocations = Dict_getIntC(args, "includeAllocations");
     Allocator_snapshot(ctx->alloc, (includeAllocations && *includeAllocations != 0));
     Dict d = Dict_CONST(String_CONST("error"), String_OBJ(String_CONST("none")), NULL);
     Admin_sendMessage(&d, txid, ctx->admin);
@@ -38,7 +38,7 @@ static void bytesAllocated(Dict* in, void* vcontext, String* txid, struct Alloca
 {
     struct Allocator_admin_pvt* ctx = Identity_check((struct Allocator_admin_pvt*)vcontext);
     Dict* d = Dict_new(requestAlloc);
-    Dict_putInt(d, String_CONST("bytes"), Allocator_bytesAllocated(ctx->alloc), requestAlloc);
+    Dict_putIntC(d, "bytes", Allocator_bytesAllocated(ctx->alloc), requestAlloc);
     Admin_sendMessage(d, txid, ctx->admin);
 }
 

+ 10 - 10
net/InterfaceController_admin.c

@@ -38,7 +38,7 @@ static void adminPeerStats(Dict* args, void* vcontext, String* txid, struct Allo
     struct Context* context = Identity_check((struct Context*)vcontext);
     struct InterfaceController_PeerStats* stats = NULL;
 
-    int64_t* page = Dict_getInt(args, String_CONST("page"));
+    int64_t* page = Dict_getIntC(args, "page");
     int i = (page) ? *page * ENTRIES_PER_PAGE : 0;
 
     int count = InterfaceController_getPeerStats(context->ic, alloc, &stats);
@@ -88,7 +88,7 @@ static void adminDisconnectPeer(Dict* args,
                                 struct Allocator* requestAlloc)
 {
     struct Context* context = Identity_check((struct Context*)vcontext);
-    String* pubkeyString = Dict_getString(args, String_CONST("pubkey"));
+    String* pubkeyString = Dict_getStringC(args, "pubkey");
 
     // parse the key
     uint8_t pubkey[32];
@@ -107,9 +107,9 @@ static void adminDisconnectPeer(Dict* args,
     }
 
     Dict* response = Dict_new(requestAlloc);
-    Dict_putInt(response, String_CONST("success"), error ? 0 : 1, requestAlloc);
+    Dict_putIntC(response, "success", error ? 0 : 1, requestAlloc);
     if (error) {
-        Dict_putString(response, String_CONST("error"), String_CONST(errorMsg), requestAlloc);
+        Dict_putStringC(response, "error", String_CONST(errorMsg), requestAlloc);
     }
 
     Admin_sendMessage(response, txid, context->admin);
@@ -121,7 +121,7 @@ static void adminResetPeering(Dict* args,
                               struct Allocator* requestAlloc)
 {
     struct Context* context = Identity_check((struct Context*)vcontext);
-    String* pubkeyString = Dict_getString(args, String_CONST("pubkey"));
+    String* pubkeyString = Dict_getStringC(args, "pubkey");
 
     int error = 0;
     char* errorMsg = NULL;
@@ -143,9 +143,9 @@ static void adminResetPeering(Dict* args,
     }
 
     Dict* response = Dict_new(requestAlloc);
-    Dict_putInt(response, String_CONST("success"), error ? 0 : 1, requestAlloc);
+    Dict_putIntC(response, "success", error ? 0 : 1, requestAlloc);
     if (error) {
-        Dict_putString(response, String_CONST("error"), String_CONST(errorMsg), requestAlloc);
+        Dict_putStringC(response, "error", String_CONST(errorMsg), requestAlloc);
     }
 
     Admin_sendMessage(response, txid, context->admin);
@@ -155,7 +155,7 @@ static void adminResetPeering(Dict* args,
 static resetSession(Dict* args, void* vcontext, String* txid, struct Allocator* requestAlloc)
 {
     struct Context* context = Identity_check((struct Context*)vcontext);
-    String* pubkeyString = Dict_getString(args, String_CONST("pubkey"));
+    String* pubkeyString = Dict_getStringC(args, "pubkey");
 
     // parse the key
     uint8_t pubkey[32];
@@ -174,9 +174,9 @@ static resetSession(Dict* args, void* vcontext, String* txid, struct Allocator*
     }
 
     Dict* response = Dict_new(requestAlloc);
-    Dict_putInt(response, String_CONST("success"), error ? 0 : 1, requestAlloc);
+    Dict_putIntC(response, "success", error ? 0 : 1, requestAlloc);
     if (error) {
-        Dict_putString(response, String_CONST("error"), String_CONST(errorMsg), requestAlloc);
+        Dict_putStringC(response, "error", String_CONST(errorMsg), requestAlloc);
     }
 
     Admin_sendMessage(response, txid, context->admin);

+ 3 - 4
net/SessionManager_admin.c

@@ -38,7 +38,7 @@ static void getHandles(Dict* args, void* vcontext, String* txid, struct Allocato
     struct Context* context = Identity_check((struct Context*) vcontext);
     struct Allocator* alloc = Allocator_child(context->alloc);
 
-    int64_t* page = Dict_getInt(args, String_CONST("page"));
+    int64_t* page = Dict_getIntC(args, "page");
     int i = (page) ? *page * ENTRIES_PER_PAGE : 0;
     struct SessionManager_HandleList* hList = SessionManager_getHandleList(context->sm, alloc);
 
@@ -51,9 +51,8 @@ static void getHandles(Dict* args, void* vcontext, String* txid, struct Allocato
     Dict_putListC(r, "handles", list, alloc);
     Dict_putIntC(r, "total", hList->length, alloc);
 
-    String* more = String_CONST("more");
     if (i < hList->length) {
-        Dict_putInt(r, more, 1, alloc);
+        Dict_putIntC(r, "more", 1, alloc);
     }
 
     Admin_sendMessage(r, txid, context->admin);
@@ -111,7 +110,7 @@ static void sessionStats(Dict* args,
                          struct Allocator* alloc)
 {
     struct Context* context = Identity_check((struct Context*) vcontext);
-    int64_t* handleP = Dict_getInt(args, String_CONST("handle"));
+    int64_t* handleP = Dict_getIntC(args, "handle");
     uint32_t handle = *handleP;
 
     struct SessionManager_Session* session = SessionManager_sessionForHandle(handle, context->sm);

+ 11 - 11
net/SwitchPinger_admin.c

@@ -49,19 +49,19 @@ static void adminPingOnResponse(struct SwitchPinger_Response* resp, void* vping)
         uint8_t path[20] = {0};
         AddrTools_printPath(path, resp->label);
         String* pathStr = String_new(path, pingAlloc);
-        Dict_putString(rd, String_CONST("rpath"), pathStr, pingAlloc);
+        Dict_putStringC(rd, "rpath", pathStr, pingAlloc);
     }
 
-    Dict_putInt(rd, String_CONST("version"), resp->version, pingAlloc);
-    Dict_putInt(rd, String_CONST("ms"), resp->milliseconds, pingAlloc);
-    Dict_putString(rd, String_CONST("result"), SwitchPinger_resultString(resp->res), pingAlloc);
-    Dict_putString(rd, String_CONST("path"), ping->path, pingAlloc);
+    Dict_putIntC(rd, "version", resp->version, pingAlloc);
+    Dict_putIntC(rd, "ms", resp->milliseconds, pingAlloc);
+    Dict_putStringC(rd, "result", SwitchPinger_resultString(resp->res), pingAlloc);
+    Dict_putStringC(rd, "path", ping->path, pingAlloc);
     if (resp->data) {
-        Dict_putString(rd, String_CONST("data"), resp->data, pingAlloc);
+        Dict_putStringC(rd, "data", resp->data, pingAlloc);
     }
 
     if (!Bits_isZero(resp->key, 32)) {
-        Dict_putString(rd, String_CONST("key"), Key_stringify(resp->key, pingAlloc), pingAlloc);
+        Dict_putStringC(rd, "key", Key_stringify(resp->key, pingAlloc), pingAlloc);
     }
 
     Admin_sendMessage(rd, ping->txid, ping->context->admin);
@@ -70,10 +70,10 @@ static void adminPingOnResponse(struct SwitchPinger_Response* resp, void* vping)
 static void adminPing(Dict* args, void* vcontext, String* txid, struct Allocator* requestAlloc)
 {
     struct Context* context = vcontext;
-    String* pathStr = Dict_getString(args, String_CONST("path"));
-    int64_t* timeoutPtr = Dict_getInt(args, String_CONST("timeout"));
-    String* data = Dict_getString(args, String_CONST("data"));
-    int64_t* keyPing = Dict_getInt(args, String_CONST("keyPing"));
+    String* pathStr = Dict_getStringC(args, "path");
+    int64_t* timeoutPtr = Dict_getIntC(args, "timeout");
+    String* data = Dict_getStringC(args, "data");
+    int64_t* keyPing = Dict_getIntC(args, "keyPing");
     uint32_t timeout = (timeoutPtr) ? *timeoutPtr : DEFAULT_TIMEOUT;
     uint64_t path;
     String* err = NULL;

+ 2 - 2
subnode/MsgCore.c

@@ -216,7 +216,7 @@ static Iface_DEFUN queryMsg(struct MsgCore_pvt* mcp,
                             struct Address* src,
                             struct Message* msg)
 {
-    String* q = Dict_getString(content, String_CONST("q"));
+    String* q = Dict_getStringC(content, "q");
     struct QueryHandler* qh = NULL;
     for (int i = 0; i < mcp->qh->length; i++) {
         struct QueryHandler* qhx = ArrayList_OfQueryHandlers_get(mcp->qh, i);
@@ -302,7 +302,7 @@ static Iface_DEFUN incoming(struct Message* msg, struct Iface* interRouterIf)
     }
     addr.protocolVersion = *verP;
 
-    String* q = Dict_getString(content, String_CONST("q"));
+    String* q = Dict_getStringC(content, "q");
 
     if (!Defined(SUBNODE)) {
         String* txid = Dict_getStringC(content, "txid");

+ 3 - 3
switch/EncodingScheme.c

@@ -292,9 +292,9 @@ struct EncodingScheme* EncodingScheme_fromList(List* scheme, struct Allocator* a
     list->forms = Allocator_malloc(alloc, sizeof(struct EncodingScheme_Form) * list->count);
     for (int i = 0; i < (int)list->count; i++) {
         Dict* form = List_getDict(scheme, i);
-        uint64_t* prefixLen = Dict_getInt(form, String_CONST("prefixLen"));
-        uint64_t* bitCount = Dict_getInt(form, String_CONST("bitCount"));
-        String* prefixStr = Dict_getString(form, String_CONST("prefix"));
+        uint64_t* prefixLen = Dict_getIntC(form, "prefixLen");
+        uint64_t* bitCount = Dict_getIntC(form, "bitCount");
+        String* prefixStr = Dict_getStringC(form, "prefix");
         if (!prefixLen || !bitCount || !prefixStr || prefixStr->len != 8) {
             return NULL;
         }

+ 25 - 25
tunnel/IpTunnel.c

@@ -364,29 +364,29 @@ static Iface_DEFUN requestForAddresses(Dict* request,
     Dict* addresses = Dict_new(requestAlloc);
     bool noAddresses = true;
     if (!Bits_isZero(conn->connectionIp6, 16)) {
-        Dict_putString(addresses,
-                       String_CONST("ip6"),
+        Dict_putStringC(addresses,
+                       "ip6",
                        String_newBinary((char*)conn->connectionIp6, 16, requestAlloc),
                        requestAlloc);
-        Dict_putInt(addresses,
-                    String_CONST("ip6Prefix"), (int64_t)conn->connectionIp6Prefix,
+        Dict_putIntC(addresses,
+                    "ip6Prefix", (int64_t)conn->connectionIp6Prefix,
                     requestAlloc);
-        Dict_putInt(addresses,
-                    String_CONST("ip6Alloc"), (int64_t)conn->connectionIp6Alloc,
+        Dict_putIntC(addresses,
+                    "ip6Alloc", (int64_t)conn->connectionIp6Alloc,
                     requestAlloc);
 
         noAddresses = false;
     }
     if (!Bits_isZero(conn->connectionIp4, 4)) {
-        Dict_putString(addresses,
-                       String_CONST("ip4"),
+        Dict_putStringC(addresses,
+                       "ip4",
                        String_newBinary((char*)conn->connectionIp4, 4, requestAlloc),
                        requestAlloc);
-        Dict_putInt(addresses,
-                    String_CONST("ip4Prefix"), (int64_t)conn->connectionIp4Prefix,
+        Dict_putIntC(addresses,
+                    "ip4Prefix", (int64_t)conn->connectionIp4Prefix,
                     requestAlloc);
-        Dict_putInt(addresses,
-                    String_CONST("ip4Alloc"), (int64_t)conn->connectionIp4Alloc,
+        Dict_putIntC(addresses,
+                    "ip4Alloc", (int64_t)conn->connectionIp4Alloc,
                     requestAlloc);
 
         noAddresses = false;
@@ -397,11 +397,11 @@ static Iface_DEFUN requestForAddresses(Dict* request,
     }
 
     Dict* msg = Dict_new(requestAlloc);
-    Dict_putDict(msg, String_CONST("addresses"), addresses, requestAlloc);
+    Dict_putDictC(msg, "addresses", addresses, requestAlloc);
 
-    String* txid = Dict_getString(request, String_CONST("txid"));
+    String* txid = Dict_getStringC(request, "txid");
     if (txid) {
-        Dict_putString(msg, String_CONST("txid"), txid, requestAlloc);
+        Dict_putStringC(msg, "txid", txid, requestAlloc);
     }
 
     sendControlMessage(msg, conn, requestAlloc, context);
@@ -455,7 +455,7 @@ static Iface_DEFUN incomingAddresses(Dict* d,
         return 0;
     }
 
-    String* txid = Dict_getString(d, String_CONST("txid"));
+    String* txid = Dict_getStringC(d, "txid");
     if (!txid || txid->len != 4) {
         Log_info(context->logger, "missing or wrong length txid");
         return 0;
@@ -484,11 +484,11 @@ static Iface_DEFUN incomingAddresses(Dict* d,
         }
     }
 
-    Dict* addresses = Dict_getDict(d, String_CONST("addresses"));
+    Dict* addresses = Dict_getDictC(d, "addresses");
 
-    String* ip4 = Dict_getString(addresses, String_CONST("ip4"));
-    int64_t* ip4Prefix = Dict_getInt(addresses, String_CONST("ip4Prefix"));
-    int64_t* ip4Alloc = Dict_getInt(addresses, String_CONST("ip4Alloc"));
+    String* ip4 = Dict_getStringC(addresses, "ip4");
+    int64_t* ip4Prefix = Dict_getIntC(addresses, "ip4Prefix");
+    int64_t* ip4Alloc = Dict_getIntC(addresses, "ip4Alloc");
 
     if (ip4 && ip4->len == 4) {
         Bits_memcpy(conn->connectionIp4, ip4->bytes, 4);
@@ -517,9 +517,9 @@ static Iface_DEFUN incomingAddresses(Dict* d,
         addAddress(printedAddr, conn->connectionIp4Prefix, conn->connectionIp4Alloc, context);
     }
 
-    String* ip6 = Dict_getString(addresses, String_CONST("ip6"));
-    int64_t* ip6Prefix = Dict_getInt(addresses, String_CONST("ip6Prefix"));
-    int64_t* ip6Alloc = Dict_getInt(addresses, String_CONST("ip6Alloc"));
+    String* ip6 = Dict_getStringC(addresses, "ip6");
+    int64_t* ip6Prefix = Dict_getIntC(addresses, "ip6Prefix");
+    int64_t* ip6Alloc = Dict_getIntC(addresses, "ip6Alloc");
 
     if (ip6 && ip6->len == 16) {
         Bits_memcpy(conn->connectionIp6, ip6->bytes, 16);
@@ -590,11 +590,11 @@ static Iface_DEFUN incomingControlMessage(struct Message* message,
         return 0;
     }
 
-    if (Dict_getDict(d, String_CONST("addresses"))) {
+    if (Dict_getDictC(d, "addresses")) {
         return incomingAddresses(d, conn, alloc, context);
     }
     if (String_equals(String_CONST("IpTunnel_getAddresses"),
-                      Dict_getString(d, String_CONST("q"))))
+                      Dict_getStringC(d, "q")))
     {
         return requestForAddresses(d, conn, alloc, context);
     }

+ 21 - 21
tunnel/IpTunnel_admin.c

@@ -55,13 +55,13 @@ static void allowConnection(Dict* args,
 {
     struct Context* context = (struct Context*) vcontext;
     String* publicKeyOfAuthorizedNode =
-        Dict_getString(args, String_CONST("publicKeyOfAuthorizedNode"));
-    String* ip6Address = Dict_getString(args, String_CONST("ip6Address"));
-    int64_t* ip6Prefix = Dict_getInt(args, String_CONST("ip6Prefix"));
-    int64_t* ip6Alloc = Dict_getInt(args, String_CONST("ip6Alloc"));
-    String* ip4Address = Dict_getString(args, String_CONST("ip4Address"));
-    int64_t* ip4Prefix = Dict_getInt(args, String_CONST("ip4Prefix"));
-    int64_t* ip4Alloc = Dict_getInt(args, String_CONST("ip4Alloc"));
+        Dict_getStringC(args, "publicKeyOfAuthorizedNode");
+    String* ip6Address = Dict_getStringC(args, "ip6Address");
+    int64_t* ip6Prefix = Dict_getIntC(args, "ip6Prefix");
+    int64_t* ip6Alloc = Dict_getIntC(args, "ip6Alloc");
+    String* ip4Address = Dict_getStringC(args, "ip4Address");
+    int64_t* ip4Prefix = Dict_getIntC(args, "ip4Prefix");
+    int64_t* ip4Alloc = Dict_getIntC(args, "ip4Alloc");
 
     uint8_t pubKey[32];
     uint8_t ip6Addr[16];
@@ -125,7 +125,7 @@ static void connectTo(Dict* args, void* vcontext, String* txid, struct Allocator
 {
     struct Context* context = vcontext;
     String* publicKeyOfNodeToConnectTo =
-        Dict_getString(args, String_CONST("publicKeyOfNodeToConnectTo"));
+        Dict_getStringC(args, "publicKeyOfNodeToConnectTo");
 
     uint8_t pubKey[32];
     uint8_t ip6[16];
@@ -145,7 +145,7 @@ static void removeConnection(Dict* args,
 {
     struct Context* context = vcontext;
 
-    int conn = (int) *(Dict_getInt(args, String_CONST("connection")));
+    int conn = (int) *(Dict_getIntC(args, "connection"));
     if (IpTunnel_removeConnection_NOT_FOUND == IpTunnel_removeConnection(conn, context->ipTun)) {
         sendError("not_found", txid, context->admin);
         return;
@@ -165,8 +165,8 @@ static void listConnections(Dict* args,
         List_addInt(l, context->ipTun->connectionList.connections[i].number, alloc);
     }
     Dict* resp = Dict_new(alloc);
-    Dict_putList(resp, String_CONST("connections"), l, alloc);
-    Dict_putString(resp, String_CONST("error"), String_CONST("none"), alloc);
+    Dict_putListC(resp, "connections", l, alloc);
+    Dict_putStringC(resp, "error", String_CONST("none"), alloc);
     Admin_sendMessage(resp, txid, context->admin);
 }
 
@@ -183,9 +183,9 @@ static void showConn(struct IpTunnel_Connection* conn,
         Assert_true(16 == Sockaddr_getAddress(addr, &address));
         Bits_memcpy(address, conn->connectionIp6, 16);
         char* printedAddr = Sockaddr_print(addr, alloc);
-        Dict_putString(d, String_CONST("ip6Address"), String_CONST(printedAddr), alloc);
-        Dict_putInt(d, String_CONST("ip6Prefix"), conn->connectionIp6Prefix, alloc);
-        Dict_putInt(d, String_CONST("ip6Alloc"), conn->connectionIp6Alloc, alloc);
+        Dict_putStringC(d, "ip6Address", String_CONST(printedAddr), alloc);
+        Dict_putIntC(d, "ip6Prefix", conn->connectionIp6Prefix, alloc);
+        Dict_putIntC(d, "ip6Alloc", conn->connectionIp6Alloc, alloc);
     }
 
     if (!Bits_isZero(conn->connectionIp4, 4)) {
@@ -194,15 +194,15 @@ static void showConn(struct IpTunnel_Connection* conn,
         Assert_true(4 == Sockaddr_getAddress(addr, &address));
         Bits_memcpy(address, conn->connectionIp4, 4);
         char* printedAddr = Sockaddr_print(addr, alloc);
-        Dict_putString(d, String_CONST("ip4Address"), String_CONST(printedAddr), alloc);
-        Dict_putInt(d, String_CONST("ip4Prefix"), conn->connectionIp4Prefix, alloc);
-        Dict_putInt(d, String_CONST("ip4Alloc"), conn->connectionIp4Alloc, alloc);
+        Dict_putStringC(d, "ip4Address", String_CONST(printedAddr), alloc);
+        Dict_putIntC(d, "ip4Prefix", conn->connectionIp4Prefix, alloc);
+        Dict_putIntC(d, "ip4Alloc", conn->connectionIp4Alloc, alloc);
     }
 
-    Dict_putString(d, String_CONST("key"),
+    Dict_putStringC(d, "key",
                       Key_stringify(conn->routeHeader.publicKey, alloc), alloc);
-    Dict_putInt(d, String_CONST("outgoing"), (conn->isOutgoing) ? 1 : 0, alloc);
-    Dict_putString(d, String_CONST("error"), String_CONST("none"), alloc);
+    Dict_putIntC(d, "outgoing", (conn->isOutgoing) ? 1 : 0, alloc);
+    Dict_putStringC(d, "error", String_CONST("none"), alloc);
 
     Admin_sendMessage(d, txid, admin);
 }
@@ -210,7 +210,7 @@ static void showConn(struct IpTunnel_Connection* conn,
 static void showConnection(Dict* args, void* vcontext, String* txid, struct Allocator* alloc)
 {
     struct Context* context = vcontext;
-    int connNum = (int) *(Dict_getInt(args, String_CONST("connection")));
+    int connNum = (int) *(Dict_getIntC(args, "connection"));
 
     for (int i = 0; i < (int)context->ipTun->connectionList.count; i++) {
         if (connNum == context->ipTun->connectionList.connections[i].number) {

+ 4 - 4
tunnel/RouteGen_admin.c

@@ -46,9 +46,9 @@ static void getSomething(Dict* args,
     int page = getIntVal(args, String_CONST("page"));
     List* routes;
     if (getIntVal(args, String_CONST("ip6"))) {
-        routes = Dict_getList(genRoutes, String_CONST("ipv6"));
+        routes = Dict_getListC(genRoutes, "ipv6");
     } else {
-        routes = Dict_getList(genRoutes, String_CONST("ipv4"));
+        routes = Dict_getListC(genRoutes, "ipv4");
     }
     Assert_true(routes);
     List* outList = List_new(requestAlloc);
@@ -105,7 +105,7 @@ static void addRemoveSomething(Dict* args,
                                enum addRemoveSomething_What what)
 {
     struct RouteGen_admin_Ctx* ctx = Identity_check((struct RouteGen_admin_Ctx*) vcontext);
-    String* route = Dict_getString(args, String_CONST("route"));
+    String* route = Dict_getStringC(args, "route");
     char* error = NULL;
 
     struct Sockaddr_storage ss;
@@ -176,7 +176,7 @@ static void commit(Dict* args,
                    struct Allocator* requestAlloc)
 {
     struct RouteGen_admin_Ctx* const ctx = Identity_check((struct RouteGen_admin_Ctx*) vcontext);
-    String* const tunName = Dict_getString(args, String_CONST("tunName"));
+    String* const tunName = Dict_getStringC(args, "tunName");
     Dict* const ret = Dict_new(requestAlloc);
     char* error;
     struct Jmp j;

+ 2 - 2
tunnel/test/RouteGen_test.c

@@ -49,8 +49,8 @@ static void runTest0(char** prefixes,
         RouteGen_addException(rg, mkSockaddr(exceptions6[i], alloc));
     }
     Dict* routes = RouteGen_getGeneratedRoutes(rg, alloc);
-    List* routes4 = Dict_getList(routes, String_CONST("ipv4"));
-    List* routes6 = Dict_getList(routes, String_CONST("ipv6"));
+    List* routes4 = Dict_getListC(routes, "ipv4");
+    List* routes6 = Dict_getListC(routes, "ipv6");
     if (expectedOut4) {
         for (int i = 0; expectedOut4[i]; i++) {
             Log_debug(log, "%s\n", expectedOut4[i]);

+ 10 - 10
util/Security_admin.c

@@ -39,10 +39,10 @@ static void setUser(Dict* args, void* vctx, String* txid, struct Allocator* requ
     struct Context* const ctx = Identity_check((struct Context*) vctx);
     struct Jmp jmp;
     Jmp_try(jmp) {
-        int64_t* user = Dict_getInt(args, String_CONST("uid"));
-        int64_t* group = Dict_getInt(args, String_CONST("gid"));
+        int64_t* user = Dict_getIntC(args, "uid");
+        int64_t* group = Dict_getIntC(args, "gid");
         int gid = group ? (int)*group : 0;
-        int64_t* keepNetAdmin = Dict_getInt(args, String_CONST("keepNetAdmin"));
+        int64_t* keepNetAdmin = Dict_getIntC(args, "keepNetAdmin");
         Security_setUser(*user, gid, *keepNetAdmin, ctx->logger, &jmp.handler, requestAlloc);
     } Jmp_catch {
         sendError(jmp.message, txid, ctx->admin);
@@ -58,11 +58,11 @@ static void checkPermissionsB(struct Except* eh,
 {
     struct Security_Permissions* sp = Security_checkPermissions(requestAlloc, eh);
     Dict* out = Dict_new(requestAlloc);
-    Dict_putInt(out, String_CONST("noOpenFiles"), sp->noOpenFiles, requestAlloc);
-    Dict_putInt(out, String_CONST("seccompExists"), sp->seccompExists, requestAlloc);
-    Dict_putInt(out, String_CONST("seccompEnforcing"), sp->seccompEnforcing, requestAlloc);
-    Dict_putInt(out, String_CONST("userId"), sp->uid, requestAlloc);
-    Dict_putString(out, String_CONST("error"), String_CONST("none"), requestAlloc);
+    Dict_putIntC(out, "noOpenFiles", sp->noOpenFiles, requestAlloc);
+    Dict_putIntC(out, "seccompExists", sp->seccompExists, requestAlloc);
+    Dict_putIntC(out, "seccompEnforcing", sp->seccompEnforcing, requestAlloc);
+    Dict_putIntC(out, "userId", sp->uid, requestAlloc);
+    Dict_putStringC(out, "error", String_CONST("none"), requestAlloc);
     Admin_sendMessage(out, txid, admin);
 }
 
@@ -107,7 +107,7 @@ static void chroot(Dict* args, void* vctx, String* txid, struct Allocator* reque
     struct Context* const ctx = Identity_check((struct Context*) vctx);
     struct Jmp jmp;
     Jmp_try(jmp) {
-        String* root = Dict_getString(args, String_CONST("root"));
+        String* root = Dict_getStringC(args, "root");
         Security_chroot(root->bytes, &jmp.handler);
     } Jmp_catch {
         sendError(jmp.message, txid, ctx->admin);
@@ -145,7 +145,7 @@ static void setupComplete(Dict* args, void* vctx, String* txid, struct Allocator
 static void getUser(Dict* args, void* vctx, String* txid, struct Allocator* requestAlloc)
 {
     struct Context* const ctx = Identity_check((struct Context*) vctx);
-    String* user = Dict_getString(args, String_CONST("user"));
+    String* user = Dict_getStringC(args, "user");
     Dict* ret = Security_getUser((user) ? user->bytes : NULL, requestAlloc);
     Admin_sendMessage(ret, txid, ctx->admin);
 }

+ 5 - 5
util/events/libuv/FileNo_admin.c

@@ -49,17 +49,17 @@ static void onResponse(struct FileNo_Promise* promise, int tunfd)
     struct FileNoRequest* fr= Identity_check((struct FileNoRequest*)promise->userData);
     Dict* resp = Dict_new(promise->alloc);
 
-    Dict_putInt(resp, String_CONST("tunfd"), tunfd, promise->alloc);
-    Dict_putInt(resp, String_CONST("type"), fr->type, promise->alloc);
-    Dict_putString(resp, String_CONST("error"), String_CONST("none"), promise->alloc);
+    Dict_putIntC(resp, "tunfd", tunfd, promise->alloc);
+    Dict_putIntC(resp, "type", fr->type, promise->alloc);
+    Dict_putStringC(resp, "error", String_CONST("none"), promise->alloc);
     Admin_sendMessage(resp, fr->txid, fr->ctx->admin);
 }
 
 static void import(Dict* args, void* vcontext, String* txid, struct Allocator* requestAlloc)
 {
     struct Context* ctx = Identity_check((struct Context*) vcontext);
-    String* path = Dict_getString(args, String_CONST("path"));
-    String* type = Dict_getString(args, String_CONST("type"));
+    String* path = Dict_getStringC(args, "path");
+    String* type = Dict_getStringC(args, "type");
     char* err = NULL;
 
     if (Defined(win32)) {