This commit is contained in:
Max Lv
2015-01-10 15:38:02 +08:00
parent 64c494e18f
commit c2d1911bb0
4 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ struct in_addr;
# define inet_XtoX_prefix inet_
#endif
#ifndef inet_XtoX_decl
# define inet_XtoX_decl __declspec(dllexport)
# define inet_XtoX_decl /* empty */
#endif
#define cc2_(x,y) cc2__(x,y)
+2 -2
View File
@@ -382,7 +382,7 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents)
uint16_t p =
ntohs(*(uint16_t *)(buf + 4 + in_addr_len));
dns_ntop(AF_INET, (const void *)(buf + 4),
host, INET_ADDRSTRLEN);
host, INET_ADDRSTRLEN);
sprintf(port, "%d", p);
}
} else if (request->atyp == 3) {
@@ -411,7 +411,7 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents)
uint16_t p =
ntohs(*(uint16_t *)(buf + 4 + in6_addr_len));
dns_ntop(AF_INET6, (const void *)(buf + 4),
host, INET6_ADDRSTRLEN);
host, INET6_ADDRSTRLEN);
sprintf(port, "%d", p);
}
} else {
+4 -4
View File
@@ -393,7 +393,7 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents)
if (r > in_addr_len) {
addr->sin_addr = *(struct in_addr *)(server->buf + offset);
dns_ntop(AF_INET, (const void *)(server->buf + offset),
host, INET_ADDRSTRLEN);
host, INET_ADDRSTRLEN);
offset += in_addr_len;
} else {
LOGE("invalid header with addr type %d", atyp);
@@ -445,7 +445,7 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents)
if (r > in6_addr_len) {
addr->sin6_addr = *(struct in6_addr *)(server->buf + offset);
dns_ntop(AF_INET6, (const void *)(server->buf + offset),
host, INET6_ADDRSTRLEN);
host, INET6_ADDRSTRLEN);
offset += in6_addr_len;
} else {
LOGE("invalid header with addr type %d", atyp);
@@ -993,8 +993,8 @@ int main(int argc, char **argv)
int option_index = 0;
static struct option long_options[] =
{
{ "fast-open", no_argument, 0, 0 },
{ 0, 0, 0, 0 }
{ "fast-open", no_argument, 0, 0 },
{ 0, 0, 0, 0 }
};
opterr = 0;
+4 -4
View File
@@ -171,7 +171,7 @@ static int parse_udprealy_header(const char * buf, const int buf_len,
}
if (host != NULL) {
dns_ntop(AF_INET, (const void *)(buf + offset),
host, INET_ADDRSTRLEN);
host, INET_ADDRSTRLEN);
}
offset += in_addr_len;
}
@@ -212,7 +212,7 @@ static int parse_udprealy_header(const char * buf, const int buf_len,
}
if (host != NULL) {
dns_ntop(AF_INET6, (const void *)(buf + offset),
host, INET6_ADDRSTRLEN);
host, INET6_ADDRSTRLEN);
}
offset += in6_addr_len;
}
@@ -242,14 +242,14 @@ static char *get_addr_str(const struct sockaddr *sa)
switch (sa->sa_family) {
case AF_INET:
dns_ntop(AF_INET, &(((struct sockaddr_in *)sa)->sin_addr),
addr, INET_ADDRSTRLEN);
addr, INET_ADDRSTRLEN);
p = ntohs(((struct sockaddr_in *)sa)->sin_port);
sprintf(port, "%d", p);
break;
case AF_INET6:
dns_ntop(AF_INET6, &(((struct sockaddr_in6 *)sa)->sin6_addr),
addr, INET6_ADDRSTRLEN);
addr, INET6_ADDRSTRLEN);
p = ntohs(((struct sockaddr_in *)sa)->sin_port);
sprintf(port, "%d", p);
break;