Lines Matching refs:buf

231             char *buf;  in get_options()  local
248 buf = mbedtls_calloc(1, len + 1); in get_options()
249 if (buf == NULL) { in get_options()
253 memcpy(buf, q, len + 1); in get_options()
255 delay_list[(*delay_cnt)++] = buf; in get_options()
385 static int ctx_buffer_flush(ctx_buffer *buf) in ctx_buffer_flush() argument
390 elapsed_time(), buf->description, in ctx_buffer_flush()
391 (unsigned) buf->len, buf->num_datagrams, in ctx_buffer_flush()
392 elapsed_time() - buf->packet_lifetime); in ctx_buffer_flush()
394 ret = mbedtls_net_send(buf->ctx, buf->data, buf->len); in ctx_buffer_flush()
396 buf->len = 0; in ctx_buffer_flush()
397 buf->num_datagrams = 0; in ctx_buffer_flush()
402 static unsigned ctx_buffer_time_remaining(ctx_buffer *buf) in ctx_buffer_time_remaining() argument
406 if (buf->num_datagrams == 0) { in ctx_buffer_time_remaining()
410 if (cur_time - buf->packet_lifetime >= opt.pack) { in ctx_buffer_time_remaining()
414 return opt.pack - (cur_time - buf->packet_lifetime); in ctx_buffer_time_remaining()
417 static int ctx_buffer_append(ctx_buffer *buf, in ctx_buffer_append() argument
427 if (len > sizeof(buf->data)) { in ctx_buffer_append()
429 (unsigned) len, (unsigned) sizeof(buf->data)); in ctx_buffer_append()
433 if (sizeof(buf->data) - buf->len < len) { in ctx_buffer_append()
434 if ((ret = ctx_buffer_flush(buf)) <= 0) { in ctx_buffer_append()
440 memcpy(buf->data + buf->len, data, len); in ctx_buffer_append()
442 buf->len += len; in ctx_buffer_append()
443 if (++buf->num_datagrams == 1) { in ctx_buffer_append()
444 buf->packet_lifetime = elapsed_time(); in ctx_buffer_append()
457 ctx_buffer *buf = NULL; in dispatch_data() local
460 buf = &outbuf[0]; in dispatch_data()
462 buf = &outbuf[1]; in dispatch_data()
465 if (buf == NULL) { in dispatch_data()
469 return ctx_buffer_append(buf, data, len); in dispatch_data()
485 unsigned char buf[MAX_MSG_SIZE]; member
550 unsigned char buf[MAX_MSG_SIZE]; in send_packet() local
551 memcpy(buf, p->buf, p->len); in send_packet()
554 buf[11] ^= 1; in send_packet()
557 if ((ret = dispatch_data(dst, buf, p->len)) <= 0) { in send_packet()
566 unsigned char buf[MAX_MSG_SIZE]; in send_packet() local
567 memcpy(buf, p->buf, p->len); in send_packet()
572 ++buf[13]; in send_packet()
576 if ((ret = dispatch_data(dst, buf, p->len)) <= 0) { in send_packet()
583 if ((ret = dispatch_data(dst, p->buf, p->len)) <= 0) { in send_packet()
594 if ((ret = dispatch_data(dst, p->buf, p->len)) <= 0) { in send_packet()
606 if ((ret = dispatch_data(dst, initial_clihlo.buf, in send_packet()
682 if ((ret = mbedtls_net_recv(src, cur.buf, sizeof(cur.buf))) <= 0) { in handle_message()
688 cur.type = msg_type(cur.buf, cur.len); in handle_message()