aboutsummaryrefslogtreecommitdiffstats
path: root/src/ipaccess-find.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-04-30 15:15:37 +0000
committerHarald Welte <laforge@gnumonks.org>2009-04-30 15:15:37 +0000
commit3788196026f8701f4b98abade3e70767275fff1c (patch)
tree1ff137fced12c732b173d835cf1cfc77dafccc81 /src/ipaccess-find.c
parent3bfbb84021bd19f6a8b131624a49ac50ceebd70e (diff)
more pretty-printing of ipaccess-find output
Diffstat (limited to 'src/ipaccess-find.c')
-rw-r--r--src/ipaccess-find.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/ipaccess-find.c b/src/ipaccess-find.c
index 8a11cd32d..63a5de10e 100644
--- a/src/ipaccess-find.c
+++ b/src/ipaccess-find.c
@@ -11,6 +11,27 @@
#include <openbsc/select.h>
#include <openbsc/timer.h>
#include <openbsc/ipaccess.h>
+#include <openbsc/gsm_data.h>
+
+static const char *idtag_names[] = {
+ [IPAC_IDTAG_SERNR] = "Serial Number",
+ [IPAC_IDTAG_UNITNAME] = "Unit Name",
+ [IPAC_IDTAG_LOCATION1] = "Location 1",
+ [IPAC_IDTAG_LOCATION2] = "Location 2",
+ [IPAC_IDTAG_EQUIPVERS] = "Equipment Version",
+ [IPAC_IDTAG_SWVERSION] = "Software Version",
+ [IPAC_IDTAG_IPADDR] = "IP Address",
+ [IPAC_IDTAG_MACADDR] = "MAC Address",
+ [IPAC_IDTAG_UNIT] = "Unit ID",
+};
+
+static const char *ipac_idtag_name(int tag)
+{
+ if (tag >= ARRAY_SIZE(idtag_names))
+ return "unknown";
+
+ return idtag_names[tag];
+}
static int udp_sock(void)
{
@@ -83,7 +104,7 @@ static int parse_response(unsigned char *buf, int len)
t_len = *cur++;
t_tag = *cur++;
- printf("tag(%02x)='%s' ", t_tag, cur);
+ printf("%s='%s' ", ipac_idtag_name(t_tag), cur);
cur += t_len;
}