new SE_COPY_ADDRESS macro
[obnox/wireshark/wip.git] / epan / address.h
index 0f202a3008328f26161ab52dd56b3adfd27f321e..3a0074a04389e28f572ebc11e5e671265bab71c8 100644 (file)
@@ -26,6 +26,8 @@
 #ifndef __ADDRESS_H__
 #define __ADDRESS_H__
 
+#include "emem.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
@@ -111,6 +113,15 @@ typedef struct _address {
        (to)->data = COPY_ADDRESS_data; \
        }
 
+#define SE_COPY_ADDRESS(to, from) { \
+       guint8 *SE_COPY_ADDRESS_data; \
+       (to)->type = (from)->type; \
+       (to)->len = (from)->len; \
+       SE_COPY_ADDRESS_data = se_alloc((from)->len); \
+       memcpy(SE_COPY_ADDRESS_data, (from)->data, (from)->len); \
+       (to)->data = SE_COPY_ADDRESS_data; \
+       }
+
 /* Types of port numbers Wireshark knows about. */
 typedef enum {
   PT_NONE,             /* no port number */