Lines Matching refs:buf

228             char *buf;  in get_options()  local
245 buf = mbedtls_calloc(1, len + 1); in get_options()
246 if (buf == NULL) { in get_options()
250 memcpy(buf, q, len + 1); in get_options()
252 delay_list[(*delay_cnt)++] = buf; in get_options()
382 static int ctx_buffer_flush(ctx_buffer *buf) in ctx_buffer_flush() argument
387 elapsed_time(), buf->description, in ctx_buffer_flush()
388 (unsigned) buf->len, buf->num_datagrams, in ctx_buffer_flush()
389 elapsed_time() - buf->packet_lifetime); in ctx_buffer_flush()
391 ret = mbedtls_net_send(buf->ctx, buf->data, buf->len); in ctx_buffer_flush()
393 buf->len = 0; in ctx_buffer_flush()
394 buf->num_datagrams = 0; in ctx_buffer_flush()
399 static unsigned ctx_buffer_time_remaining(ctx_buffer *buf) in ctx_buffer_time_remaining() argument
403 if (buf->num_datagrams == 0) { in ctx_buffer_time_remaining()
407 if (cur_time - buf->packet_lifetime >= opt.pack) { in ctx_buffer_time_remaining()
411 return opt.pack - (cur_time - buf->packet_lifetime); in ctx_buffer_time_remaining()
414 static int ctx_buffer_append(ctx_buffer *buf, in ctx_buffer_append() argument
424 if (len > sizeof(buf->data)) { in ctx_buffer_append()
426 (unsigned) len, (unsigned) sizeof(buf->data)); in ctx_buffer_append()
430 if (sizeof(buf->data) - buf->len < len) { in ctx_buffer_append()
431 if ((ret = ctx_buffer_flush(buf)) <= 0) { in ctx_buffer_append()
437 memcpy(buf->data + buf->len, data, len); in ctx_buffer_append()
439 buf->len += len; in ctx_buffer_append()
440 if (++buf->num_datagrams == 1) { in ctx_buffer_append()
441 buf->packet_lifetime = elapsed_time(); in ctx_buffer_append()
454 ctx_buffer *buf = NULL; in dispatch_data() local
457 buf = &outbuf[0]; in dispatch_data()
459 buf = &outbuf[1]; in dispatch_data()
462 if (buf == NULL) { in dispatch_data()
466 return ctx_buffer_append(buf, data, len); in dispatch_data()
482 unsigned char buf[MAX_MSG_SIZE]; member
547 unsigned char buf[MAX_MSG_SIZE]; in send_packet() local
548 memcpy(buf, p->buf, p->len); in send_packet()
551 buf[11] ^= 1; in send_packet()
554 if ((ret = dispatch_data(dst, buf, p->len)) <= 0) { in send_packet()
563 unsigned char buf[MAX_MSG_SIZE]; in send_packet() local
564 memcpy(buf, p->buf, p->len); in send_packet()
569 ++buf[13]; in send_packet()
573 if ((ret = dispatch_data(dst, buf, p->len)) <= 0) { in send_packet()
580 if ((ret = dispatch_data(dst, p->buf, p->len)) <= 0) { in send_packet()
591 if ((ret = dispatch_data(dst, p->buf, p->len)) <= 0) { in send_packet()
603 if ((ret = dispatch_data(dst, initial_clihlo.buf, in send_packet()
679 if ((ret = mbedtls_net_recv(src, cur.buf, sizeof(cur.buf))) <= 0) { in handle_message()
685 cur.type = msg_type(cur.buf, cur.len); in handle_message()