Diffstat (limited to 'noncore/net/wellenreiter/daemon/source/getgui.cc') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/getgui.cc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/getgui.cc b/noncore/net/wellenreiter/daemon/source/getgui.cc new file mode 100644 index 0000000..f56f40b --- a/dev/null +++ b/noncore/net/wellenreiter/daemon/source/getgui.cc @@ -0,0 +1,43 @@ +/* + * Setup UDP socket for commands + * Misc wrapper functions for incoming commands + * + * $Id$ + */ + +#include "config.hh" +#include "getgui.hh" +#include "log.hh" + +struct sockaddr_in saddr; + +/* Setup UDP Socket for incoming commands */ +int commsock(int *sock) +{ + + if((*sock=socket(AF_INET, SOCK_DGRAM, 0)) < 0) + { + log_err("Cannot set up socket: %s", strerror(errno)); + return 0; + } + + memset(&saddr, 0, sizeof(saddr)); + saddr.sin_family = PF_INET; + saddr.sin_port = htons(DAEMONPORT); + saddr.sin_addr.s_addr = htonl(INADDR_ANY); + + if(bind(*sock,(struct sockaddr *)&saddr, sizeof(saddr)) < 0) + { + log_err("Cannot bind socket: %s", strerror(errno)); + close(*sock); + return 0; + } + + return 1; +} + +int commstring(const char *input) +{ + + return 1; +} |