-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NETOBSERV-1890: read TCP flags as strings
- Loading branch information
Showing
6 changed files
with
34 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,22 @@ | ||
import { ReadOnlyValue, ReadOnlyValues } from './values'; | ||
|
||
export const getTCPFlagsDocUrl = () => { | ||
return 'https://www.rfc-editor.org/rfc/rfc9293'; | ||
}; | ||
|
||
export const tcpFlagsList: ReadOnlyValues = [ | ||
{ value: 1, name: 'FIN', description: 'No more data from sender' }, | ||
{ value: 2, name: 'SYN', description: 'Synchronize sequence numbers' }, | ||
{ value: 4, name: 'RST', description: 'Reset the connection' }, | ||
{ value: 8, name: 'PSH', description: 'Push function' }, | ||
{ value: 16, name: 'ACK', description: 'Acknowledgement field is significant' }, | ||
{ value: 32, name: 'URG', description: 'Urgent pointer field is significant' }, | ||
{ value: 64, name: 'ECE', description: 'ECN-Echo' }, | ||
{ value: 128, name: 'CWR', description: 'Congestion Window Reduced' }, | ||
{ value: 256, name: 'SYN_ACK', description: 'Acknowledgement of SYN (custom flag)' }, | ||
{ value: 512, name: 'FIN_ACK', description: 'Acknowledgement of FIN (custom flag)' }, | ||
{ value: 1024, name: 'RST_ACK', description: 'Acknowledgement of RST (custom flag)' } | ||
export const tcpFlagsList = [ | ||
{ name: 'FIN', description: 'No more data from sender' }, | ||
{ name: 'SYN', description: 'Synchronize sequence numbers' }, | ||
{ name: 'RST', description: 'Reset the connection' }, | ||
{ name: 'PSH', description: 'Push function' }, | ||
{ name: 'ACK', description: 'Acknowledgement field is significant' }, | ||
{ name: 'URG', description: 'Urgent pointer field is significant' }, | ||
{ name: 'ECE', description: 'ECN-Echo' }, | ||
{ name: 'CWR', description: 'Congestion Window Reduced' }, | ||
{ name: 'SYN_ACK', description: 'Acknowledgement of SYN (custom flag)' }, | ||
{ name: 'FIN_ACK', description: 'Acknowledgement of FIN (custom flag)' }, | ||
{ name: 'RST_ACK', description: 'Acknowledgement of RST (custom flag)' } | ||
] as const; | ||
|
||
export const decomposeTCPFlagsBitfield = (bitfield: number): ReadOnlyValues => { | ||
const values: ReadOnlyValue[] = []; | ||
tcpFlagsList.forEach(flag => { | ||
if (bitfield & flag.value) { | ||
values.push(flag); | ||
} | ||
}); | ||
return values; | ||
export const getFlagsList = (joined: string): { name: string, description: string}[] => { | ||
const names = joined.split(','); | ||
return tcpFlagsList.filter(f => names.includes(f.name)); | ||
}; |