diff options
Diffstat (limited to 'src/messages.h')
-rw-r--r-- | src/messages.h | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/src/messages.h b/src/messages.h index 6da04e5..acf248c 100644 --- a/src/messages.h +++ b/src/messages.h @@ -125,27 +125,4 @@ enum { HANDSHAKE_DSCP = 0b10001000 /* AF41, plus 00 ECN */ }; -static const unsigned int message_header_sizes[MESSAGE_TOTAL] = { - [MESSAGE_HANDSHAKE_INITIATION] = sizeof(struct message_handshake_initiation), - [MESSAGE_HANDSHAKE_RESPONSE] = sizeof(struct message_handshake_response), - [MESSAGE_HANDSHAKE_COOKIE] = sizeof(struct message_handshake_cookie), - [MESSAGE_DATA] = sizeof(struct message_data) -}; - -static inline enum message_type message_determine_type(struct sk_buff *skb) -{ - struct message_header *header = (struct message_header *)skb->data; - if (unlikely(skb->len < sizeof(struct message_header))) - return MESSAGE_INVALID; - if (header->type == cpu_to_le32(MESSAGE_DATA) && skb->len >= MESSAGE_MINIMUM_LENGTH) - return MESSAGE_DATA; - if (header->type == cpu_to_le32(MESSAGE_HANDSHAKE_INITIATION) && skb->len == sizeof(struct message_handshake_initiation)) - return MESSAGE_HANDSHAKE_INITIATION; - if (header->type == cpu_to_le32(MESSAGE_HANDSHAKE_RESPONSE) && skb->len == sizeof(struct message_handshake_response)) - return MESSAGE_HANDSHAKE_RESPONSE; - if (header->type == cpu_to_le32(MESSAGE_HANDSHAKE_COOKIE) && skb->len == sizeof(struct message_handshake_cookie)) - return MESSAGE_HANDSHAKE_COOKIE; - return MESSAGE_INVALID; -} - #endif |