diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-02-17 03:45:06 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-02-17 03:45:06 +0000 |
commit | 8d7ffcc99b02ffd0315e32ab26678fe6058f1289 (patch) | |
tree | e42f5dcc01845d5517399b454286f3e1816b8063 /airpcap.h | |
parent | 806cb7224df91bbaac0744a881c185fdf25fe9ea (diff) | |
download | wireshark-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.h | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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. |