version 1.1, 2011/10/04 22:37:46
|
version 1.1.1.1.2.1, 2011/10/07 13:41:26
|
Line 15 icmpTx(sched_task_t *task)
|
Line 15 icmpTx(sched_task_t *task)
|
{ |
{ |
struct tagProc *proc; |
struct tagProc *proc; |
int wlen; |
int wlen; |
|
u_char *str; |
|
|
FTRACE(3); |
FTRACE(3); |
|
|
Line 22 icmpTx(sched_task_t *task)
|
Line 23 icmpTx(sched_task_t *task)
|
if (!(proc = TASK_ARG(task))) |
if (!(proc = TASK_ARG(task))) |
return (void*) -1; |
return (void*) -1; |
|
|
if ((wlen = icmpSend(TASK_FD(task), proc->proc_id, proc->proc_flg, proc->proc_buf_[FD2NET], | if (Crypted) { |
| str = cryptBuffer(proc->proc_buf_[FD2NET], proc->proc_rlen_[FD2NET], Crypted); |
| if (str) { |
| memcpy(proc->proc_buf_[FD2NET], str, proc->proc_rlen_[FD2NET]); |
| free(str); |
| } |
| } |
| |
| if ((wlen = icmpSend(TASK_FD(task), proc->proc_id, proc->proc_flg, Crypted, proc->proc_buf_[FD2NET], |
proc->proc_rlen_[FD2NET], &proc->proc_cli, sizeof proc->proc_cli)) != ANSH_FLG_ERR) { |
proc->proc_rlen_[FD2NET], &proc->proc_cli, sizeof proc->proc_cli)) != ANSH_FLG_ERR) { |
proc->proc_flg = ANSH_FLG_OK; |
proc->proc_flg = ANSH_FLG_OK; |
proc->proc_rlen_[FD2NET] = 0; |
proc->proc_rlen_[FD2NET] = 0; |
Line 35 icmpTx(sched_task_t *task)
|
Line 44 icmpTx(sched_task_t *task)
|
void * |
void * |
icmpRx(sched_task_t *task) |
icmpRx(sched_task_t *task) |
{ |
{ |
u_char *buf; | u_char *buf, *str; |
struct sockaddr sa; |
struct sockaddr sa; |
int rlen, n = 0, salen = sizeof sa; |
int rlen, n = 0, salen = sizeof sa; |
struct tagProc *proc = NULL; |
struct tagProc *proc = NULL; |
Line 48 icmpRx(sched_task_t *task)
|
Line 57 icmpRx(sched_task_t *task)
|
if (!(buf = malloc(rlen))) |
if (!(buf = malloc(rlen))) |
goto end; |
goto end; |
|
|
if ((ret = icmpRecv(TASK_FD(task), &id, buf, &rlen, &sa, (socklen_t *) &salen)) == ANSH_FLG_ERR) | if ((ret = icmpRecv(TASK_FD(task), &id, &Crypted, buf, &rlen, &sa, (socklen_t *) &salen)) == ANSH_FLG_ERR) |
goto end; |
goto end; |
VERB(5) LOG("Received %d bytes", rlen); |
VERB(5) LOG("Received %d bytes", rlen); |
if (!(ret & ANSH_FLG_CPOUT)) |
if (!(ret & ANSH_FLG_CPOUT)) |
Line 64 icmpRx(sched_task_t *task)
|
Line 73 icmpRx(sched_task_t *task)
|
if (n != ANSH_CODE) { |
if (n != ANSH_CODE) { |
proc = NULL; |
proc = NULL; |
goto end; |
goto end; |
|
} |
|
|
|
if (Crypted) { |
|
str = cryptBuffer(buf, rlen, Crypted); |
|
if (str) { |
|
memcpy(buf, str, rlen); |
|
free(str); |
|
} |
} |
} |
|
|
switch (ret) { |
switch (ret) { |