Lines Matching refs:buf
240 char *buf; in get_options() local
261 buf = mbedtls_calloc( 1, len + 1 ); in get_options()
262 if( buf == NULL ) in get_options()
267 memcpy( buf, q, len + 1 ); in get_options()
269 delay_list[ (*delay_cnt)++ ] = buf; in get_options()
406 static int ctx_buffer_flush( ctx_buffer *buf ) in ctx_buffer_flush() argument
411 ellapsed_time(), buf->description, in ctx_buffer_flush()
412 (unsigned) buf->len, buf->num_datagrams, in ctx_buffer_flush()
413 ellapsed_time() - buf->packet_lifetime ); in ctx_buffer_flush()
415 ret = mbedtls_net_send( buf->ctx, buf->data, buf->len ); in ctx_buffer_flush()
417 buf->len = 0; in ctx_buffer_flush()
418 buf->num_datagrams = 0; in ctx_buffer_flush()
423 static unsigned ctx_buffer_time_remaining( ctx_buffer *buf ) in ctx_buffer_time_remaining() argument
427 if( buf->num_datagrams == 0 ) in ctx_buffer_time_remaining()
430 if( cur_time - buf->packet_lifetime >= opt.pack ) in ctx_buffer_time_remaining()
433 return( opt.pack - ( cur_time - buf->packet_lifetime ) ); in ctx_buffer_time_remaining()
436 static int ctx_buffer_append( ctx_buffer *buf, in ctx_buffer_append() argument
445 if( len > sizeof( buf->data ) ) in ctx_buffer_append()
448 (unsigned) len, (unsigned) sizeof( buf->data ) ); in ctx_buffer_append()
452 if( sizeof( buf->data ) - buf->len < len ) in ctx_buffer_append()
454 if( ( ret = ctx_buffer_flush( buf ) ) <= 0 ) in ctx_buffer_append()
461 memcpy( buf->data + buf->len, data, len ); in ctx_buffer_append()
463 buf->len += len; in ctx_buffer_append()
464 if( ++buf->num_datagrams == 1 ) in ctx_buffer_append()
465 buf->packet_lifetime = ellapsed_time(); in ctx_buffer_append()
477 ctx_buffer *buf = NULL; in dispatch_data() local
481 buf = &outbuf[0]; in dispatch_data()
483 buf = &outbuf[1]; in dispatch_data()
485 if( buf == NULL ) in dispatch_data()
488 return( ctx_buffer_append( buf, data, len ) ); in dispatch_data()
506 unsigned char buf[MAX_MSG_SIZE]; member
571 unsigned char buf[MAX_MSG_SIZE]; in send_packet() local
572 memcpy( buf, p->buf, p->len ); in send_packet()
575 buf[11] ^= 1; in send_packet()
578 if( ( ret = dispatch_data( dst, buf, p->len ) ) <= 0 ) in send_packet()
589 unsigned char buf[MAX_MSG_SIZE]; in send_packet() local
590 memcpy( buf, p->buf, p->len ); in send_packet()
598 ++buf[13]; in send_packet()
602 if( ( ret = dispatch_data( dst, buf, p->len ) ) <= 0 ) in send_packet()
610 if( ( ret = dispatch_data( dst, p->buf, p->len ) ) <= 0 ) in send_packet()
623 if( ( ret = dispatch_data( dst, p->buf, p->len ) ) <= 0 ) in send_packet()
637 if( ( ret = dispatch_data( dst, initial_clihlo.buf, in send_packet()
713 if( ( ret = mbedtls_net_recv( src, cur.buf, sizeof( cur.buf ) ) ) <= 0 ) in handle_message()
720 cur.type = msg_type( cur.buf, cur.len ); in handle_message()