2 * * Copyright (C) 2007 Ubiquiti Networks, Inc.
4 * * This program is free software; you can redistribute it and/or
5 * * modify it under the terms of the GNU General Public License as
6 * * published by the Free Software Foundation; either version 2 of the
7 * * License, or (at your option) any later version.
9 * * This program is distributed in the hope that it will be useful, but
10 * * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * * General Public License for more details.
14 * * You should have received a copy of the GNU General Public License
15 * * along with this program; if not, write to the Free Software
16 * * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <sys/types.h>
24 #define MAGIC_HEADER "OPEN"
25 #define MAGIC_PART "PART"
26 #define MAGIC_END "END."
27 #define MAGIC_ENDS "ENDS"
29 #define MAGIC_LENGTH 4
30 #define PART_NAME_LENGTH 16
32 typedef struct header
{
33 char magic
[MAGIC_LENGTH
];
37 } __attribute__ ((packed
)) header_t
;
40 char magic
[MAGIC_LENGTH
];
41 char name
[PART_NAME_LENGTH
];
49 } __attribute__ ((packed
)) part_t
;
51 typedef struct part_crc
{
54 } __attribute__ ((packed
)) part_crc_t
;
56 typedef struct signature
{
57 char magic
[MAGIC_LENGTH
];
60 } __attribute__ ((packed
)) signature_t
;
62 typedef struct signature_rsa
{
63 char magic
[MAGIC_LENGTH
];
65 unsigned char rsa_signature
[256];
67 } __attribute__ ((packed
)) signature_rsa_t
;
71 #define INFO(...) fprintf(stdout, __VA_ARGS__)
72 #define ERROR(...) fprintf(stderr, "ERROR: "__VA_ARGS__)
73 #define WARN(...) fprintf(stderr, "WARN: "__VA_ARGS__)
74 #define DEBUG(...) do {\
76 fprintf(stdout, "DEBUG: "__VA_ARGS__); \