/* * Copyright (c) 1998-2007 The TCPDUMP project * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that: (1) source code * distributions retain the above copyright notice and this paragraph * in its entirety, and (2) distributions including binary code include * the above copyright notice and this paragraph in its entirety in * the documentation or other materials provided with the distribution. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE. * * Support for the Light Weight Access Point Protocol as per draft-ohara-capwap-lwapp-04 * * Original code by Carles Kishimoto */ #define NETDISSECT_REWORKED #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "interface.h" #include "extract.h" #include "addrtoname.h" /* * LWAPP transport (common) header * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |VER| RID |C|F|L| Frag ID | Length | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Status/WLANs | Payload... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * */ struct lwapp_transport_header { uint8_t version; uint8_t frag_id; uint8_t length[2]; uint16_t status; }; /* * LWAPP control header * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Message Type | Seq Num | Msg Element Length | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Session ID | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | Msg Element [0..N] | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ struct lwapp_control_header { uint8_t msg_type; uint8_t seq_num; uint8_t len[2]; uint8_t session_id[4]; }; #define LWAPP_VERSION 0 #define LWAPP_EXTRACT_VERSION(x) (((x)&0xC0)>>6) #define LWAPP_EXTRACT_RID(x) (((x)&0x38)>>3) #define LWAPP_EXTRACT_CONTROL_BIT(x) (((x)&0x04)>>2) static const struct tok lwapp_header_bits_values[] = { { 0x01, "Last Fragment Bit"}, { 0x02, "Fragment Bit"}, { 0x04, "Control Bit"}, { 0, NULL} }; #define LWAPP_MSGTYPE_DISCOVERY_REQUEST 1 #define LWAPP_MSGTYPE_DISCOVERY_RESPONSE 2 #define LWAPP_MSGTYPE_JOIN_REQUEST 3 #define LWAPP_MSGTYPE_JOIN_RESPONSE 4 #define LWAPP_MSGTYPE_JOIN_ACK 5 #define LWAPP_MSGTYPE_JOIN_CONFIRM 6 #define LWAPP_MSGTYPE_CONFIGURE_REQUEST 10 #define LWAPP_MSGTYPE_CONFIGURE_RESPONSE 11 #define LWAPP_MSGTYPE_CONF_UPDATE_REQUEST 12 #define LWAPP_MSGTYPE_CONF_UPDATE_RESPONSE 13 #define LWAPP_MSGTYPE_WTP_EVENT_REQUEST 14 #define LWAPP_MSGTYPE_WTP_EVENT_RESPONSE 15 #define LWAPP_MSGTYPE_CHANGE_STATE_EVENT_REQUEST 16 #define LWAPP_MSGTYPE_CHANGE_STATE_EVENT_RESPONSE 17 #define LWAPP_MSGTYPE_ECHO_REQUEST 22 #define LWAPP_MSGTYPE_ECHO_RESPONSE 23 #define LWAPP_MSGTYPE_IMAGE_DATA_REQUEST 24 #define LWAPP_MSGTYPE_IMAGE_DATA_RESPONSE 25 #define LWAPP_MSGTYPE_RESET_REQUEST 26 #define LWAPP_MSGTYPE_RESET_RESPONSE 27 #define LWAPP_MSGTYPE_KEY_UPDATE_REQUEST 30 #define LWAPP_MSGTYPE_KEY_UPDATE_RESPONSE 31 #define LWAPP_MSGTYPE_PRIMARY_DISCOVERY_REQUEST 32 #define LWAPP_MSGTYPE_PRIMARY_DISCOVERY_RESPONSE 33 #define LWAPP_MSGTYPE_DATA_TRANSFER_REQUEST 34 #define LWAPP_MSGTYPE_DATA_TRANSFER_RESPONSE 35 #define LWAPP_MSGTYPE_CLEAR_CONFIG_INDICATION 36 #define LWAPP_MSGTYPE_WLAN_CONFIG_REQUEST 37 #define LWAPP_MSGTYPE_WLAN_CONFIG_RESPONSE 38 #define LWAPP_MSGTYPE_MOBILE_CONFIG_REQUEST 3