projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More preparatory work: remove the <windows.h> include from lots of
[u/mdw/putty]
/
winnet.c
diff --git
a/winnet.c
b/winnet.c
index
7cadf86
..
430a47b
100644
(file)
--- a/
winnet.c
+++ b/
winnet.c
@@
-370,7
+370,7
@@
void sk_getaddr(SockAddr addr, char *buf, int buflen)
int sk_addrtype(SockAddr addr)
{
int sk_addrtype(SockAddr addr)
{
- return
addr->family
;
+ return
(addr->family == AF_INET ? ADDRTYPE_IPV4 : ADDRTYPE_IPV6)
;
}
void sk_addrcopy(SockAddr addr, char *buf)
}
void sk_addrcopy(SockAddr addr, char *buf)
@@
-833,7
+833,9
@@
void try_send(Actual_Socket s)
s->pending_error = err;
return;
} else {
s->pending_error = err;
return;
} else {
- logevent(winsock_error_string(err));
+ /* We're inside the Windows frontend here, so we know
+ * that the frontend handle is unnecessary. */
+ logevent(NULL, winsock_error_string(err));
fatalbox("%s", winsock_error_string(err));
}
} else {
fatalbox("%s", winsock_error_string(err));
}
} else {
@@
-972,7
+974,9
@@
int select_result(WPARAM wParam, LPARAM lParam)
if (ret <= 0) {
char *str = (ret == 0 ? "Internal networking trouble" :
winsock_error_string(WSAGetLastError()));
if (ret <= 0) {
char *str = (ret == 0 ? "Internal networking trouble" :
winsock_error_string(WSAGetLastError()));
- logevent(str);
+ /* We're inside the Windows frontend here, so we know
+ * that the frontend handle is unnecessary. */
+ logevent(NULL, str);
fatalbox("%s", str);
} else {
return plug_receive(s->plug, 2, buf, ret);
fatalbox("%s", str);
} else {
return plug_receive(s->plug, 2, buf, ret);
@@
-1134,3
+1138,13
@@
SOCKET next_socket(int *state)
Actual_Socket s = index234(sktree, (*state)++);
return s ? s->s : INVALID_SOCKET;
}
Actual_Socket s = index234(sktree, (*state)++);
return s ? s->s : INVALID_SOCKET;
}
+
+int net_service_lookup(char *service)
+{
+ struct servent *se;
+ se = getservbyname(service, NULL);
+ if (se != NULL)
+ return ntohs(se->s_port);
+ else
+ return 0;
+}