new get_in_addr

This commit is contained in:
Lennart Buhl 2013-11-03 13:14:25 +01:00
parent 9a0995dbd0
commit de9b0555a7
2 changed files with 14 additions and 12 deletions

View File

@ -17,16 +17,19 @@
#include "net.h" #include "net.h"
// kleiner helfer // little helper
// auch von bejee geguttenbergt static void *get_in_addr(struct sockaddr *sa) {
// switch (sa->sa_family) {
void *get_in_addr(struct sockaddr *sa) case AF_INET:
{
if (sa->sa_family == AF_INET) {
return &(((struct sockaddr_in*)sa)->sin_addr); return &(((struct sockaddr_in*)sa)->sin_addr);
} break;
case AF_INET6:
return &(((struct sockaddr_in6*)sa)->sin6_addr); return &(((struct sockaddr_in6*)sa)->sin6_addr);
break;
case AF_UNSPEC:
default:
return NULL;
}
} }

View File

@ -6,7 +6,6 @@
#include "msg.h" // message serialization #include "msg.h" // message serialization
#include "display.h" // callback #include "display.h" // callback
void *get_in_addr(struct sockaddr *sa);
int run_server(const struct prog_info *pinfo, char *img, int w, int h); int run_server(const struct prog_info *pinfo, char *img, int w, int h);
int run_client(const struct prog_info *pinfo,void(*framecallback)(const struct message *, const struct prog_info *)); int run_client(const struct prog_info *pinfo,void(*framecallback)(const struct message *, const struct prog_info *));