author | mjm <mjm> | 2002-11-12 22:12:33 (UTC) |
---|---|---|
committer | mjm <mjm> | 2002-11-12 22:12:33 (UTC) |
commit | eaecbed44924ece119c5b41db2828b4554f263d2 (patch) (side-by-side diff) | |
tree | b87dd3d049ea1768b20192f6c674f8684a41282c /noncore/net/wellenreiter/daemon/source/getgui.cc | |
parent | 15bc80dffd7a4c52985a742cb3a439da42692478 (diff) | |
download | opie-eaecbed44924ece119c5b41db2828b4554f263d2.zip opie-eaecbed44924ece119c5b41db2828b4554f263d2.tar.gz opie-eaecbed44924ece119c5b41db2828b4554f263d2.tar.bz2 |
pre-alpha version, most things does not work yet.
todo: communication protocol with GUI and implementation of sniffer
Diffstat (limited to 'noncore/net/wellenreiter/daemon/source/getgui.cc') (more/less context) (ignore 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; +} |