socket or -1 on error. This blocks the process while trying to create
the connection. */
-int silc_net_create_connection(int port, char *host)
+int silc_net_create_connection(const char *local_ip, int port,
+ const char *host)
{
SOCKET sock;
int rval, err;
connection returns directly. To get the result of the connect() one
must select() the socket and read the result after it's ready. */
-int silc_net_create_connection_async(int port, char *host)
+int silc_net_create_connection_async(const char *local_ip, int port,
+ const char *host)
{
SOCKET sock;
int rval, err;
/* Converts the IP number string from numbers-and-dots notation to
binary form. */
-bool silc_net_addr2bin(const char *addr, unsigned char *bin,
- uint32 bin_len)
+bool silc_net_addr2bin(const char *addr, void *bin, uint32 bin_len);
{
unsigned long ret;
if (bin_len < 4)
return FALSE;
- SILC_PUT32_LSB(ret, bin);
+ memcpy(bin, (unsigned char *)&tmp.s_addr, 4);
+ return ret != INADDR_NONE;
+}
+
+/* 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)
+{
+ unsigned long ret;
+
+ ret = inet_addr(addr);
+
+ if (bin_len < 4)
+ return FALSE;
+
+ SILC_PUT32_MSB(ret, bin);
return ret != INADDR_NONE;
}