summaryrefslogtreecommitdiff
path: root/util/subs.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/subs.c')
-rw-r--r--util/subs.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/util/subs.c b/util/subs.c
index 9f11423..c5f9308 100644
--- a/util/subs.c
+++ b/util/subs.c
@@ -163,6 +163,23 @@ void lperror(int level, const char * format, ...)
return;
}
+#ifdef LANHELPER
+uint32_t buf2long(uint8_t * buf);
+uint16_t buf2short(uint8_t * buf);
+void printbuf(const uint8_t * buf, int len, const char * desc);
+const char * buf2str(uint8_t * buf, int len);
+const char * oemval2str(uint16_t oem, uint16_t val, const struct oemvalstr *vs);
+const char * val2str(uint16_t val, const struct valstr *vs);
+uint16_t str2val(const char *str, const struct valstr *vs);
+#else
+ulong buf2long(uchar * buf)
+{
+ return (ulong)(buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]);
+}
+ushort buf2short(uchar * buf)
+{
+ return (ushort)(buf[1] << 8 | buf[0]);
+}
void printbuf(const uchar * buf, int len, const char * desc)
{
int i;
@@ -190,14 +207,6 @@ const char * buf2str(uchar * buf, int len)
str[len*2] = '\0';
return (const char *)str;
}
-ushort buf2short(uchar * buf)
-{
- return (ushort)(buf[1] << 8 | buf[0]);
-}
-ulong buf2long(uchar * buf)
-{
- return (ulong)(buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]);
-}
#define IPMI_OEM_PICMG 12634
#define SZUN 32
@@ -237,6 +246,7 @@ ushort str2val( char *str, struct valstr *vs)
}
return vs[i].val;
}
+#endif
void dump_buf(char *tag, uchar *pbuf, int sz, char fshowascii)