diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-12-23 13:09:27 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-12-23 13:09:27 +0100 |
commit | bf2bdc6e840035ccd7481b2b362c583fb498d5fe (patch) | |
tree | 1e547e3513b832ed1861b7b2e3de0fb6101713be /openbsc | |
parent | e0d2ff4c2e60549ebb82488d1e8457b26810d8bd (diff) |
[ipaccess] The next byte appears to be size...
Using okteta to display the size in bigendian and
then selecting from the start to the " SDP" I get
the same number...
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/src/ipaccess-firmware/ipaccess-firmware.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/openbsc/src/ipaccess-firmware/ipaccess-firmware.c b/openbsc/src/ipaccess-firmware/ipaccess-firmware.c index 413f84511..e2e5008c0 100644 --- a/openbsc/src/ipaccess-firmware/ipaccess-firmware.c +++ b/openbsc/src/ipaccess-firmware/ipaccess-firmware.c @@ -19,6 +19,7 @@ * */ +#include <arpa/inet.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -36,6 +37,7 @@ static void analyze_file(int fd) { char buf[4096]; int rc; + unsigned int absolute_size; rc = read(fd, buf, 4); if (rc <= 0) { @@ -59,7 +61,17 @@ static void analyze_file(int fd) return; } + rc = read(fd, buf, 4); + if (rc <= 0) { + fprintf(stderr, "Trying to read the header length failed.\n"); + return; + } + + memcpy(&absolute_size, &buf[0], 4); + absolute_size = ntohl(absolute_size); + printf("Printing header information:\n"); + printf("The header is %u bytes long\n", absolute_size); } int main(int argc, char** argv) |