X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=daemon%2Ffnet-adc.c;h=84a63aaa4df0e404303f3f7a17022d44c7f09885;hb=e03e1e7c23b2f527d43ec72b01c93185ebc63008;hp=1357257e88654e249174dbebfa2bda59a3786499;hpb=58e83d6a687fa3c5b27f255d64c2770df5c8aff5;p=doldaconnect.git diff --git a/daemon/fnet-adc.c b/daemon/fnet-adc.c index 1357257..84a63aa 100644 --- a/daemon/fnet-adc.c +++ b/daemon/fnet-adc.c @@ -38,7 +38,7 @@ #include "transfer.h" #include "sysevents.h" #include "net.h" -#include "tiger.h" +#include /* Protocol states */ #define ADC_PROTOCOL 0 @@ -67,6 +67,7 @@ struct adchub { wchar_t **sup; iconv_t ich; int state; + struct wcspair *hubinf; struct qcmd *queue; }; @@ -191,7 +192,14 @@ static void freeqcmd(struct qcmd *qcmd) } #define ADC_CMDFN(name) static void name(struct fnetnode *fn, wchar_t *command, wchar_t *sender, int argc, wchar_t **argv) -#define ADC_CMDCOM struct socket *sk = fn->sk; struct adchub *hub = fn->data; +#ifdef __GNUC__ +#define UNUSED __attribute__ ((unused)) +#else +#define UNUSED +#endif +#define ADC_CMDCOM \ + struct socket *sk UNUSED = fn->sk; \ + struct adchub *hub UNUSED = fn->data; ADC_CMDFN(cmd_sup) { @@ -215,6 +223,7 @@ ADC_CMDFN(cmd_sup) } else if(!wcsncmp(argv[i], L"RM", 2)) { if(!f) continue; + free(hub->sup[o]); memmove(hub->sup[o], hub->sup[o + 1], parrlen(hub->sup) - o); } } @@ -232,9 +241,19 @@ ADC_CMDFN(cmd_sid) } } +ADC_CMDFN(cmd_inf) +{ + ADC_CMDCOM; + + if(sender == NULL) { + + } +} + static struct command hubcmds[] = { {L"SUP", 1, 0, cmd_sup}, {L"SID", 2, 0, cmd_sid}, + {L"INF", 0, 0, cmd_inf}, {NULL, 0, 0, NULL} }; @@ -376,7 +395,7 @@ static int hubreqconn(struct fnetpeer *peer) return(0); } -static struct fnet adcnet = { +static struct fnet adcnet_store = { .connect = hubconnect, .destroy = hubdestroy, .setnick = hubsetnick, @@ -384,6 +403,8 @@ static struct fnet adcnet = { .name = L"adc" }; +static struct fnet *adcnet = &adcnet_store; + static int run(void) { int ret; @@ -394,7 +415,7 @@ static int run(void) ret = 0; for(fn = fnetnodes; fn != NULL; fn = nextfn) { nextfn = fn->next; - if(fn->fnet != &adcnet) + if(fn->fnet != adcnet) continue; if((hub = fn->data) == NULL) continue; @@ -413,7 +434,7 @@ static void preinit(int hup) { if(hup) return; - regfnet(&adcnet); + regfnet(adcnet); } static int init(int hup) @@ -455,7 +476,15 @@ static void terminate(void) } static struct configvar myvars[] = { + /** Specifies a specific UDP port to use for ADC search + * results. If left unspecified, a port is allocated + * dynamically. Useful for NAT routers (see also the + * net.visibleipv4 address for those cases). */ {CONF_VAR_INT, "udpport", {.num = 0}}, + /** Specifies a specific TCP port to use for ADC peer + * connections. If left unspecified, a port is allocated + * dynamically. Useful for NAT routers (see also the + * net.visibleipv4 address for those cases). */ {CONF_VAR_INT, "tcpport", {.num = 0}}, {CONF_VAR_END} };