Lines Matching refs:buf
241 char *buf; in get_options() local
258 buf = mbedtls_calloc(1, len + 1); in get_options()
259 if (buf == NULL) { in get_options()
263 memcpy(buf, q, len + 1); in get_options()
265 delay_list[(*delay_cnt)++] = buf; in get_options()
395 static int ctx_buffer_flush(ctx_buffer *buf) in ctx_buffer_flush() argument
400 elapsed_time(), buf->description, in ctx_buffer_flush()
401 (unsigned) buf->len, buf->num_datagrams, in ctx_buffer_flush()
402 elapsed_time() - buf->packet_lifetime); in ctx_buffer_flush()
404 ret = mbedtls_net_send(buf->ctx, buf->data, buf->len); in ctx_buffer_flush()
406 buf->len = 0; in ctx_buffer_flush()
407 buf->num_datagrams = 0; in ctx_buffer_flush()
412 static unsigned ctx_buffer_time_remaining(ctx_buffer *buf) in ctx_buffer_time_remaining() argument
416 if (buf->num_datagrams == 0) { in ctx_buffer_time_remaining()
420 if (cur_time - buf->packet_lifetime >= opt.pack) { in ctx_buffer_time_remaining()
424 return opt.pack - (cur_time - buf->packet_lifetime); in ctx_buffer_time_remaining()
427 static int ctx_buffer_append(ctx_buffer *buf, in ctx_buffer_append() argument
437 if (len > sizeof(buf->data)) { in ctx_buffer_append()
439 (unsigned) len, (unsigned) sizeof(buf->data)); in ctx_buffer_append()
443 if (sizeof(buf->data) - buf->len < len) { in ctx_buffer_append()
444 if ((ret = ctx_buffer_flush(buf)) <= 0) { in ctx_buffer_append()
450 memcpy(buf->data + buf->len, data, len); in ctx_buffer_append()
452 buf->len += len; in ctx_buffer_append()
453 if (++buf->num_datagrams == 1) { in ctx_buffer_append()
454 buf->packet_lifetime = elapsed_time(); in ctx_buffer_append()
467 ctx_buffer *buf = NULL; in dispatch_data() local
470 buf = &outbuf[0]; in dispatch_data()
472 buf = &outbuf[1]; in dispatch_data()
475 if (buf == NULL) { in dispatch_data()
479 return ctx_buffer_append(buf, data, len); in dispatch_data()
495 unsigned char buf[MAX_MSG_SIZE]; member
560 unsigned char buf[MAX_MSG_SIZE]; in send_packet() local
561 memcpy(buf, p->buf, p->len); in send_packet()
564 buf[11] ^= 1; in send_packet()
567 if ((ret = dispatch_data(dst, buf, p->len)) <= 0) { in send_packet()
576 unsigned char buf[MAX_MSG_SIZE]; in send_packet() local
577 memcpy(buf, p->buf, p->len); in send_packet()
582 ++buf[13]; in send_packet()
586 if ((ret = dispatch_data(dst, buf, p->len)) <= 0) { in send_packet()
593 if ((ret = dispatch_data(dst, p->buf, p->len)) <= 0) { in send_packet()
604 if ((ret = dispatch_data(dst, p->buf, p->len)) <= 0) { in send_packet()
616 if ((ret = dispatch_data(dst, initial_clihlo.buf, in send_packet()
692 if ((ret = mbedtls_net_recv(src, cur.buf, sizeof(cur.buf))) <= 0) { in handle_message()
698 cur.type = msg_type(cur.buf, cur.len); in handle_message()