aboutsummaryrefslogtreecommitdiffstats
path: root/airpcap.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-02-17 03:45:06 +0000
committerGuy Harris <guy@alum.mit.edu>2013-02-17 03:45:06 +0000
commit8d7ffcc99b02ffd0315e32ab26678fe6058f1289 (patch)
treee42f5dcc01845d5517399b454286f3e1816b8063 /airpcap.h
parent806cb7224df91bbaac0744a881c185fdf25fe9ea (diff)
downloadwireshark-8d7ffcc99b02ffd0315e32ab26678fe6058f1289.tar.gz
wireshark-8d7ffcc99b02ffd0315e32ab26678fe6058f1289.tar.bz2
wireshark-8d7ffcc99b02ffd0315e32ab26678fe6058f1289.zip
Add a macro that, for a given count of keys, returns the total size of
an AirpcapKeysCollection structure with that number of keys, and use it instead of doing the calculation manually. svn path=/trunk/; revision=47699
Diffstat (limited to 'airpcap.h')
-rw-r--r--airpcap.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/airpcap.h b/airpcap.h
index 8813ed0e13..dd245451dc 100644
--- a/airpcap.h
+++ b/airpcap.h
@@ -169,13 +169,13 @@ AirpcapMacAddress, *PAirpcapMacAddress;
/*!
\brief This structure is used to store a collection of WEP keys.
Note that the definition of the structure doesn't contain any key, so be careful to allocate a buffer
- with the size of the key, like in the following example:
+ with the size of the set of keys, as per the following example:
\code
PAirpcapKeysCollection KeysCollection;
guint KeysCollectionSize;
- KeysCollectionSize = sizeof(AirpcapKeysCollection) + NumKeys * sizeof(AirpcapKey);
+ KeysCollectionSize = AirpcapKeysCollectionSize(NumKeys);
KeysCollection = (PAirpcapKeysCollection)malloc(KeysCollectionSize);
if(!KeysCollection)
@@ -190,6 +190,8 @@ typedef struct _AirpcapKeysCollection
AirpcapKey Keys[0]; /* < Array of nKeys keys. */
} AirpcapKeysCollection, *PAirpcapKeysCollection;
+#define AirpcapKeysCollectionSize(nKeys) (sizeof(AirpcapKeysCollection) + ((nKeys) * sizeof(AirpcapKey)))
+
/*!
\brief Packet header.