]> granicus.if.org Git - pdns/commitdiff
dnsdist: Make getMsgLen32 and putMsgLen32 static
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 4 Dec 2018 10:26:00 +0000 (11:26 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 4 Dec 2018 10:26:00 +0000 (11:26 +0100)
Only the console code uses them nowadays, so no need to export them.

pdns/dnsdist-console.cc
pdns/dnsdist.hh

index da894202abb878a03bc963f7794cf7214b6fbef3..091fa4bd85d2bf9abc3329bce4db8a4422804590 100644 (file)
@@ -76,6 +76,33 @@ static string historyFile(const bool &ignoreHOME = false)
   return ret;
 }
 
+static bool getMsgLen32(int fd, uint32_t* len)
+try
+{
+  uint32_t raw;
+  size_t ret = readn2(fd, &raw, sizeof raw);
+  if(ret != sizeof raw)
+    return false;
+  *len = ntohl(raw);
+  if(*len > g_consoleOutputMsgMaxSize)
+    return false;
+  return true;
+}
+catch(...) {
+   return false;
+}
+
+static bool putMsgLen32(int fd, uint32_t len)
+try
+{
+  uint32_t raw = htonl(len);
+  size_t ret = writen2(fd, &raw, sizeof raw);
+  return ret==sizeof raw;
+}
+catch(...) {
+  return false;
+}
+
 static bool sendMessageToServer(int fd, const std::string& line, SodiumNonce& readingNonce, SodiumNonce& writingNonce, const bool outputEmptyLine)
 {
   string msg = sodEncryptSym(line, g_consoleKey, writingNonce);
@@ -707,30 +734,3 @@ catch(const std::exception& e)
   close(fd);
   errlog("Control connection died: %s", e.what());
 }
-
-bool getMsgLen32(int fd, uint32_t* len)
-try
-{
-  uint32_t raw;
-  size_t ret = readn2(fd, &raw, sizeof raw);
-  if(ret != sizeof raw)
-    return false;
-  *len = ntohl(raw);
-  if(*len > g_consoleOutputMsgMaxSize)
-    return false;
-  return true;
-}
-catch(...) {
-   return false;
-}
-
-bool putMsgLen32(int fd, uint32_t len)
-try
-{
-  uint32_t raw = htonl(len);
-  size_t ret = writen2(fd, &raw, sizeof raw);
-  return ret==sizeof raw;
-}
-catch(...) {
-  return false;
-}
index 651d5b881003d29f4fdeac3c33c9bf3031c4bf34..c4ae2bac3ac5021cc9dec6859dbec435745096c9 100644 (file)
@@ -1009,8 +1009,6 @@ void setWebserverPassword(const std::string& password);
 void setWebserverCustomHeaders(const boost::optional<std::map<std::string, std::string> > customHeaders);
 
 void dnsdistWebserverThread(int sock, const ComboAddress& local);
-bool getMsgLen32(int fd, uint32_t* len);
-bool putMsgLen32(int fd, uint32_t len);
 void tcpAcceptorThread(void* p);
 
 void setLuaNoSideEffect(); // if nothing has been declared, set that there are no side effects