#include "transfer.h"
#include "sysevents.h"
#include "net.h"
-#include "tiger.h"
+#include <tiger.h>
/* Protocol states */
#define ADC_PROTOCOL 0
wchar_t **sup;
iconv_t ich;
int state;
+ struct wcspair *hubinf;
struct qcmd *queue;
};
} 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);
}
}
}
}
+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}
};
flog(LOG_DEBUG, "unknown adc command: %ls", qcmd->args[0]);
}
-static void hubread(struct socket *sk, struct fnetnode *fn)
+static int hubread(struct socket *sk, struct fnetnode *fn)
{
int ret;
struct adchub *hub;
hub = fn->data;
if((newbuf = sockgetinbuf(sk, &datalen)) == NULL)
- return;
+ return(0);
if(hub->inbufdata > 1024)
hub->inbufdata = 0;
bufcat(hub->inbuf, newbuf, datalen);
if(errno == EILSEQ) {
flog(LOG_DEBUG, "adc fnetnode %i sent illegal utf-8 sequence", fn->id);
killfnetnode(fn);
- return;
+ return(0);
} else if(errno == EINVAL) {
break;
} else if(errno == E2BIG) {
/* continue; */
} else {
flog(LOG_WARNING, "bug? iconv returned unexpected error: %s", strerror(errno));
- return;
+ return(0);
}
}
}
newqcmd(&hub->queue, parseadc(hub->cb));
memmove(hub->cb, p, (hub->cbdata -= (p - hub->cb)) * sizeof(*(hub->cb)));
}
+ return(0);
}
-static void huberr(struct socket *sk, int err, struct fnetnode *fn)
+static int huberr(struct socket *sk, int err, struct fnetnode *fn)
{
killfnetnode(fn);
+ return(0);
}
static void hubconnect(struct fnetnode *fn)
{
struct adchub *hub;
- fn->sk->readcb = (void (*)(struct socket *, void *))hubread;
- fn->sk->errcb = (void (*)(struct socket *, int, void *))huberr;
- fn->sk->data = fn;
- getfnetnode(fn);
+ CBREG(fn->sk, socket_read, (int (*)(struct socket *, void *))hubread, (void (*)(void *))putfnetnode, fn);
+ CBREG(fn->sk, socket_err, (int (*)(struct socket *, int, void *))huberr, (void (*)(void *))putfnetnode, fn);
hub = smalloc(sizeof(*hub));
memset(hub, 0, sizeof(*hub));