updates.
[silc.git] / lib / silcutil / unix / silcunixnet.c
index 5268d5540172eb8d7cf908c2acfea2f8c0f83e64..4a97ee314e7daf765d4101cf9b70b1d6f1f749ef 100644 (file)
@@ -285,3 +285,22 @@ bool silc_net_addr2bin(const char *addr, unsigned char *bin,
 
   return ret != 0;
 }
+
+/* Converts the IP number string from numbers-and-dots notation to
+   binary form in network byte order. */
+
+bool silc_net_addr2bin_ne(const char *addr, unsigned char *bin,
+                         uint32 bin_len)
+{
+  struct in_addr tmp;
+  int ret;
+
+  ret = inet_aton(addr, &tmp);
+
+  if (bin_len < 4)
+    return FALSE;
+
+  SILC_PUT32_MSB(tmp.s_addr, bin);
+
+  return ret != 0;
+}