• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/rp-l2tp/libevent/

Lines Matching refs:state

25 static void free_state(EventTcpState *state);
85 EventTcpConnectState *state = (EventTcpConnectState *) data;
90 Event_DelHandler(es, state->conn);
91 state->conn = NULL;
96 state->f(es, fd, EVENT_TCP_FLAG_TIMEOUT, state->data);
97 free(state);
103 state->f(es, fd, EVENT_TCP_FLAG_IOERROR, state->data);
104 free(state);
109 state->f(es, fd, EVENT_TCP_FLAG_IOERROR, state->data);
110 free(state);
115 state->f(es, fd, EVENT_TCP_FLAG_COMPLETE, state->data);
116 free(state);
157 * state -- EventTcpState to free
161 * Frees all state associated with the TcpEvent.
164 free_state(EventTcpState *state)
166 if (!state) return;
167 EVENT_DEBUG(("tcp_free_state(state=%p)\n", state));
168 if (state->buf) free(state->buf);
169 if (state->eh) Event_DelHandler(state->es, state->eh);
170 free(state);
191 EventTcpState *state = (EventTcpState *) data;
192 int done = state->cur - state->buf;
193 int togo = state->len - done;
202 (state->f)(es, state->socket, state->buf, done, EVENT_TCP_FLAG_TIMEOUT,
203 state->data);
204 free_state(state);
207 if (state->delim < 0) {
210 nread = read(fd, state->cur, togo);
219 (state->f)(es, state->socket, state->buf, done, flag, state->data);
220 free_state(state);
223 state->cur += nread;
225 if (done >= state->len) {
227 (state->f)(es, state->socket, state->buf, done,
228 EVENT_TCP_FLAG_COMPLETE, state->data);
229 free_state(state);
234 while ( (togo > 0) && (nread = read(fd, state->cur, 1)) == 1) {
237 state->cur++;
238 if (*(state->cur - 1) == state->delim) break;
254 (state->f)(es, state->socket, state->buf, done, flag, state->data);
255 free_state(state);
278 EventTcpState *state = (EventTcpState *) data;
279 int done = state->cur - state->buf;
280 int togo = state->len - done;
286 if (state->f) {
287 (state->f)(es, state->socket, state->buf, done, EVENT_TCP_FLAG_TIMEOUT,
288 state->data);
292 free_state(state);
297 n = write(fd, state->cur, togo);
302 if (state->f) {
303 (state->f)(es, state->socket, state->buf, done,
305 state->data);
309 free_state(state);
312 state->cur += n;
314 if (done >= state->len) {
316 if (state->f) {
317 (state->f)(es, state->socket, state->buf, done,
318 EVENT_TCP_FLAG_COMPLETE, state->data);
322 free_state(state);
354 EventTcpState *state;
371 state = malloc(sizeof(EventTcpState));
372 if (!state) return NULL;
374 memset(state, 0, sizeof(EventTcpState));
376 state->socket = socket;
378 state->buf = malloc(len);
379 if (!state->buf) {
380 free_state(state);
384 state->cur = state->buf;
385 state->len = len;
386 state->f = f;
387 state->es = es;
397 state->eh = Event_AddHandlerWithTimeout(es, socket, EVENT_FLAG_READABLE,
399 (void *) state);
400 if (!state->eh) {
401 free_state(state);
404 state->data = data;
405 state->delim = delim;
406 EVENT_DEBUG(("EventTcp_ReadBuf() -> %p\n", state));
408 return state;
435 EventTcpState *state;
452 state = malloc(sizeof(EventTcpState));
453 if (!state) return NULL;
455 memset(state, 0, sizeof(EventTcpState));
457 state->socket = socket;
459 state->buf = malloc(len);
460 if (!state->buf) {
461 free_state(state);
464 memcpy(state->buf, buf, len);
466 state->cur = state->buf;
467 state->len = len;
468 state->f = f;
469 state->es = es;
479 state->eh = Event_AddHandlerWithTimeout(es, socket, EVENT_FLAG_WRITEABLE,
481 (void *) state);
482 if (!state->eh) {
483 free_state(state);
487 state->data = data;
488 state->delim = -1;
489 EVENT_DEBUG(("EventTcp_WriteBuf() -> %p\n", state));
490 return state;
518 EventTcpConnectState *state;
541 state = malloc(sizeof(*state));
542 if (!state) {
546 state->f = f;
547 state->fd = fd;
548 state->data = data;
558 state->conn = Event_AddHandlerWithTimeout(es, fd, EVENT_FLAG_WRITEABLE,
560 (void *) state);
561 if (!state->conn) {
562 free(state);