disperse atalk-utils.[ch]
The functionality was suiting for address_to_str.c and the #defines belong in packet-atalk.h. Kept the address structure with the "address string conversion", but that can probably be better cleaned up when the address to str as a whole is cleaned up. Would also consider making AT_ATALK an FT_ type as well. Change-Id: Ia534096c707e6fb94acdfee0d332beda6571c371 Reviewed-on: https://code.wireshark.org/review/6417 Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
d296c75247
commit
456095c89d
|
@ -1549,7 +1549,6 @@ set(LIBWIRESHARK_FILES
|
|||
aftypes.c
|
||||
app_mem_usage.c
|
||||
asn1.c
|
||||
atalk-utils.c
|
||||
charsets.c
|
||||
circuit.c
|
||||
column.c
|
||||
|
|
|
@ -29,7 +29,6 @@ LIBWIRESHARK_SRC = \
|
|||
aftypes.c \
|
||||
app_mem_usage.c \
|
||||
asn1.c \
|
||||
atalk-utils.c \
|
||||
charsets.c \
|
||||
circuit.c \
|
||||
color_dissector_filters.c \
|
||||
|
@ -157,7 +156,6 @@ LIBWIRESHARK_INCLUDES = \
|
|||
arcnet_pids.h \
|
||||
arptypes.h \
|
||||
asn1.h \
|
||||
atalk-utils.h \
|
||||
ax25_pids.h \
|
||||
bridged_pids.h \
|
||||
charsets.h \
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
#include "addr_resolv.h"
|
||||
#include "wsutil/pint.h"
|
||||
#include "wsutil/str_util.h"
|
||||
#include "atalk-utils.h"
|
||||
#include "sna-utils.h"
|
||||
#include "osi-utils.h"
|
||||
#include <epan/dissectors/packet-mtp3.h>
|
||||
|
@ -359,6 +358,22 @@ fcwwn_addr_to_str_buf(const guint8 *addrp, gchar *buf, int buf_len)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atalk_addr_to_str_buf(const struct atalk_ddp_addr *addrp, gchar *buf, int buf_len)
|
||||
{
|
||||
g_snprintf(buf, buf_len, "%u.%u", addrp->net, addrp->node );
|
||||
}
|
||||
|
||||
gchar *
|
||||
atalk_addr_to_str(const struct atalk_ddp_addr *addrp)
|
||||
{
|
||||
gchar *cur;
|
||||
|
||||
cur=(gchar *)wmem_alloc(wmem_packet_scope(), 14);
|
||||
atalk_addr_to_str_buf(addrp, cur, 14);
|
||||
return cur;
|
||||
}
|
||||
|
||||
gchar*
|
||||
tvb_address_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, address_type type, const gint offset)
|
||||
{
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
/* atalk-utils.c
|
||||
* Routines for Appletalk utilities (DDP, currently).
|
||||
*
|
||||
* Simon Wilkinson <sxw@dcs.ed.ac.uk>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "atalk-utils.h"
|
||||
#include "emem.h"
|
||||
|
||||
gchar *
|
||||
atalk_addr_to_str(const struct atalk_ddp_addr *addrp)
|
||||
{
|
||||
gchar *cur;
|
||||
|
||||
cur=(gchar *)ep_alloc(14);
|
||||
atalk_addr_to_str_buf(addrp, cur, 14);
|
||||
return cur;
|
||||
}
|
||||
|
||||
void
|
||||
atalk_addr_to_str_buf(const struct atalk_ddp_addr *addrp, gchar *buf, int buf_len)
|
||||
{
|
||||
g_snprintf(buf, buf_len, "%u.%u", addrp->net, addrp->node );
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
* Local Variables:
|
||||
* c-basic-offset: 2
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*
|
||||
* ex: set shiftwidth=2 tabstop=8 expandtab:
|
||||
* :indentSize=2:tabSize=8:noTabs=true:
|
||||
*/
|
|
@ -1,61 +0,0 @@
|
|||
/* atalk-utils.h
|
||||
* Definitions for Appletalk utilities (DDP, currently).
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __ATALK_UTILS_H__
|
||||
#define __ATALK_UTILS_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Structure used to represent a DDP address; gives the layout of the
|
||||
* data pointed to by an AT_ATALK "address" structure.
|
||||
*/
|
||||
struct atalk_ddp_addr {
|
||||
guint16 net;
|
||||
guint8 node;
|
||||
};
|
||||
|
||||
/*
|
||||
* DDP packet types.
|
||||
*/
|
||||
#define DDP_RTMPDATA 0x01
|
||||
#define DDP_NBP 0x02
|
||||
#define DDP_ATP 0x03
|
||||
#define DDP_AEP 0x04
|
||||
#define DDP_RTMPREQ 0x05
|
||||
#define DDP_ZIP 0x06
|
||||
#define DDP_ADSP 0x07
|
||||
#define DDP_EIGRP 0x58
|
||||
|
||||
/*
|
||||
* Routines to take a DDP address and generate a string.
|
||||
*/
|
||||
extern gchar *atalk_addr_to_str(const struct atalk_ddp_addr *addrp);
|
||||
extern void atalk_addr_to_str_buf(const struct atalk_ddp_addr *addrp,
|
||||
gchar *buf, int buf_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
|
@ -28,7 +28,6 @@
|
|||
#include "column-utils.h"
|
||||
#include "timestamp.h"
|
||||
#include "sna-utils.h"
|
||||
#include "atalk-utils.h"
|
||||
#include "to_str.h"
|
||||
#include "packet_info.h"
|
||||
#include "wsutil/pint.h"
|
||||
|
|
|
@ -31,10 +31,10 @@
|
|||
#include <epan/ppptypes.h>
|
||||
#include <epan/aftypes.h>
|
||||
#include <epan/arcnet_pids.h>
|
||||
#include <epan/atalk-utils.h>
|
||||
#include <epan/conversation.h>
|
||||
#include <epan/prefs.h>
|
||||
#include <epan/reassemble.h>
|
||||
#include <epan/to_str.h>
|
||||
#include <wiretap/wtap.h>
|
||||
#include "packet-atalk.h"
|
||||
#include "packet-afp.h"
|
||||
|
|
|
@ -21,6 +21,18 @@
|
|||
|
||||
#include "ws_symbol_export.h"
|
||||
|
||||
/*
|
||||
* DDP packet types.
|
||||
*/
|
||||
#define DDP_RTMPDATA 0x01
|
||||
#define DDP_NBP 0x02
|
||||
#define DDP_ATP 0x03
|
||||
#define DDP_AEP 0x04
|
||||
#define DDP_RTMPREQ 0x05
|
||||
#define DDP_ZIP 0x06
|
||||
#define DDP_ADSP 0x07
|
||||
#define DDP_EIGRP 0x58
|
||||
|
||||
WS_DLL_PUBLIC void capture_llap(packet_counts *ld);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,12 +28,12 @@
|
|||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/addr_resolv.h>
|
||||
#include <epan/atalk-utils.h>
|
||||
#include <epan/addr_and_mask.h>
|
||||
#include <epan/ipproto.h>
|
||||
#include <epan/expert.h>
|
||||
|
||||
#include "packet-ipx.h"
|
||||
#include "packet-atalk.h"
|
||||
|
||||
/**
|
||||
* EIGRP Header size in bytes
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "packet.h"
|
||||
#include "timestamp.h"
|
||||
|
||||
#include "atalk-utils.h"
|
||||
#include "sna-utils.h"
|
||||
#include "osi-utils.h"
|
||||
#include "to_str.h"
|
||||
|
|
|
@ -68,6 +68,7 @@ void ip6_to_str_buf(const struct e_in6_addr *, gchar *);
|
|||
extern gchar* ipx_addr_to_str(const guint32, const guint8 *);
|
||||
extern gchar* ipxnet_to_str_punct(const guint32 ad, const char punct);
|
||||
WS_DLL_PUBLIC gchar* eui64_to_str(const guint64 ad);
|
||||
|
||||
WS_DLL_PUBLIC gchar* time_secs_to_str(wmem_allocator_t *scope, const gint32 time_val);
|
||||
gchar* time_secs_to_str_unsigned(wmem_allocator_t *scope, const guint32);
|
||||
WS_DLL_PUBLIC gchar* time_msecs_to_str(wmem_allocator_t *scope, gint32 time_val);
|
||||
|
@ -94,6 +95,20 @@ WS_DLL_PUBLIC char *decode_bitfield_value(char *buf, const guint64 val, const gu
|
|||
|
||||
WS_DLL_PUBLIC const gchar* port_type_to_str (port_type type);
|
||||
|
||||
/*
|
||||
* Routines to take a DDP address and generate a string.
|
||||
*/
|
||||
/*
|
||||
* Structure used to represent a DDP address; gives the layout of the
|
||||
* data pointed to by an AT_ATALK "address" structure.
|
||||
*/
|
||||
struct atalk_ddp_addr {
|
||||
guint16 net;
|
||||
guint8 node;
|
||||
};
|
||||
|
||||
extern gchar *atalk_addr_to_str(const struct atalk_ddp_addr *addrp);
|
||||
|
||||
/** Turn an address type retrieved from a tvb into a string.
|
||||
*
|
||||
* @param scope memory allocation scheme used
|
||||
|
|
Loading…
Reference in New Issue