Skip to content

Commit

Permalink
[ADD] tcp: add tcp_complete key to know if all data is available or not
Browse files Browse the repository at this point in the history
  • Loading branch information
qdeconinck committed Mar 16, 2016
1 parent fdba40b commit 25e8c40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ class TSharkError(Exception):
TYPE = 'type'
# Interface: CELL or WIFI
IF = 'interface'
# Indicate if the connection has full info or only a subset
TCP_COMPLETE = 'tcp_complete'
# Source IP address
SADDR = 'saddr'
# Destination IP address
Expand Down
4 changes: 4 additions & 0 deletions tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def extract_tstat_data_tcp_complete(filename, connections, conn_id):
info = line.split()
conn_id += 1
connection = TCPConnection(conn_id)
connection.flow.attr[co.TCP_COMPLETE] = True
connection.flow.attr[co.SADDR] = co.long_ipv6_address(info[0])
connection.flow.attr[co.DADDR] = co.long_ipv6_address(info[14])
connection.flow.attr[co.SPORT] = info[1]
Expand Down Expand Up @@ -214,6 +215,8 @@ def extract_tstat_data_tcp_nocomplete(filename, connections, conn_id):
conn_id += 1
connection = TCPConnection(conn_id)

connection.flow.attr[co.TCP_COMPLETE] = False

connection.flow.attr[co.SADDR] = co.long_ipv6_address(info[0])
connection.flow.attr[co.DADDR] = co.long_ipv6_address(info[14])
connection.flow.attr[co.SPORT] = info[1]
Expand Down Expand Up @@ -530,6 +533,7 @@ def copy_info_to_mptcp_connections(connections, mptcp_connections, failed_conns,
conn_id, flow_id = get_flow_name_connection_optimized(connection, mptcp_connections, fast_conns=fast_conns)
if isinstance(conn_id, (int, long)):
mptcp_connections[conn_id].flows[flow_id].subflow_id = flow_name
mptcp_connections[conn_id].flows[flow_id].attr[co.TCP_COMPLETE] = connection.flow.attr[co.TCP_COMPLETE]
mptcp_connections[conn_id].flows[flow_id].attr[co.START] = connection.flow.attr[co.START]
mptcp_connections[conn_id].flows[flow_id].attr[co.DURATION] = connection.flow.attr[co.DURATION]
if co.BACKUP in connection.attr:
Expand Down

0 comments on commit 25e8c40

Please sign in to comment.