adding new_connection_id in quic15

This commit is contained in:
Ken McMillan 2018-10-11 14:45:36 -07:00
Родитель 3e75b6563d
Коммит ed3fd8b324
6 изменённых файлов: 85 добавлений и 11 удалений

Просмотреть файл

@ -1103,6 +1103,20 @@ object frame = { ...
}
}
# New connection if frames are used to transmit additional cid's to the peer.
object frame = { ...
object new_connection_id = { ...
action handle(f:frame.new_connection_id,src:ip.endpoint,dst:ip.endpoint,scid:cid,dcid:cid,e:encryption_level)
around handle {
require e = encryption_level.other & establisted_1rtt_keys(src,scid);
require num_queued_frames(src,scid) > 0 -> e = queued_level(src,scid);
...
call enqueue_frame(src,scid,f,e);
}
}
}
# ### Packet number decoding

Просмотреть файл

@ -49,6 +49,10 @@ object quic_deser = {}
quic_connection_close_reason,
quic_application_close_err_code,
quic_max_stream_data_id,
quic_new_connection_id_length,
quic_new_connection_id_seq_num,
quic_new_connection_id_scid,
quic_new_connection_id_token,
quic_s_done} state;
bool long_format;
char hdr_type;
@ -297,6 +301,30 @@ object quic_deser = {}
state = quic_s_retry_token;
}
break;
case quic_new_connection_id_length:
{
getn(res,1);
scil = res;
state = quic_new_connection_id_scid;
}
break;
case quic_new_connection_id_seq_num:
{
get_var_int(res);
state = quic_new_connection_id_length;
}
break;
case quic_new_connection_id_scid:
{
getn(res,scil);
state = quic_new_connection_id_token;
}
break;
case quic_new_connection_id_token:
{
getn(res,16);
}
break;
default:
throw deser_err();
}
@ -368,6 +396,10 @@ object quic_deser = {}
state = quic_application_close_err_code;
return 9;
}
if (frame_type == 0x0b) {
state = quic_new_connection_id_seq_num;
return 10;
}
std::cerr << "saw tag " << ft << std::endl;
}
throw deser_err();

Просмотреть файл

@ -137,6 +137,19 @@ object frame = {
}
}
object new_connection_id = {
# New connection id frames are a variant of frame.
variant this of frame = struct {
seq_num : cid_seq, # the sequence number of the new cid
length : cid_length, # the length of the new cid in bytes
scid : cid, # the new cid
token : reset_token # the stateless reset token
}
}
instance idx : unbounded_sequence
instance arr : array(idx,this)
}

Просмотреть файл

@ -14,17 +14,6 @@ include quic_frame
# or *short* format.
#
# ### Packet type bits
# The type `type_bits` represents the packet type as a 7-bit unsigned integer.
type type_bits
interpret type_bits -> bv[7]
type cid_length
interpret cid_length -> bv[4]
# TODO: not needed?
# object quic_long_type = {
# type this = {initial,retry,handshake,zero_rtt_protected}

Просмотреть файл

@ -85,3 +85,27 @@ object encryption_level = {
}
}
}
# ### Packet type bits
# The type `type_bits` represents the packet type as a 7-bit unsigned integer.
type type_bits
interpret type_bits -> bv[7]
# This type represents the length of a connection id in bytes
type cid_length
interpret cid_length -> bv[4]
# Connection id sequence numbers
type cid_seq
interpret cid_seq -> bv[8]
# Stateless reset tokens
type reset_token
interpret reset_token -> bv[31]

Просмотреть файл

@ -16,6 +16,7 @@ tests = [
['quic_server_test_stream','test_completed'],
['quic_server_test_reset_stream','test_completed'],
['quic_server_test_connection_close','test_completed'],
['quic_server_test_max','test_completed'],
]
],
]
@ -95,6 +96,7 @@ class Test(object):
try:
retcode = proc.wait()
except KeyboardInterrupt:
print 'terminating client process {}'.format(proc.pid)
proc.terminate()
raise KeyboardInterrupt
if retcode == 124: