OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * * Copyright (C) 2007 Ubiquiti Networks, Inc. |
||
3 | * * |
||
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. |
||
8 | * * |
||
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. |
||
13 | * * |
||
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. |
||
17 | * */ |
||
18 | |||
19 | #ifndef FW_INCLUDED |
||
20 | #define FW_INCLUDED |
||
21 | |||
22 | #include <sys/types.h> |
||
23 | |||
24 | #define MAGIC_HEADER "OPEN" |
||
25 | #define MAGIC_PART "PART" |
||
26 | #define MAGIC_END "END." |
||
27 | #define MAGIC_ENDS "ENDS" |
||
28 | |||
29 | #define MAGIC_LENGTH 4 |
||
30 | |||
31 | typedef struct header { |
||
32 | char magic[MAGIC_LENGTH]; |
||
33 | char version[256]; |
||
34 | u_int32_t crc; |
||
35 | u_int32_t pad; |
||
36 | } __attribute__ ((packed)) header_t; |
||
37 | |||
38 | typedef struct part { |
||
39 | char magic[MAGIC_LENGTH]; |
||
40 | char name[16]; |
||
41 | char pad[12]; |
||
42 | u_int32_t memaddr; |
||
43 | u_int32_t index; |
||
44 | u_int32_t baseaddr; |
||
45 | u_int32_t entryaddr; |
||
46 | u_int32_t data_size; |
||
47 | u_int32_t part_size; |
||
48 | } __attribute__ ((packed)) part_t; |
||
49 | |||
50 | typedef struct part_crc { |
||
51 | u_int32_t crc; |
||
52 | u_int32_t pad; |
||
53 | } __attribute__ ((packed)) part_crc_t; |
||
54 | |||
55 | typedef struct signature { |
||
56 | char magic[MAGIC_LENGTH]; |
||
57 | u_int32_t crc; |
||
58 | u_int32_t pad; |
||
59 | } __attribute__ ((packed)) signature_t; |
||
60 | |||
61 | typedef struct signature_rsa { |
||
62 | char magic[MAGIC_LENGTH]; |
||
63 | // u_int32_t crc; |
||
64 | unsigned char rsa_signature[256]; |
||
65 | u_int32_t pad; |
||
66 | } __attribute__ ((packed)) signature_rsa_t; |
||
67 | |||
68 | #define VERSION "1.2" |
||
69 | |||
70 | #define INFO(...) fprintf(stdout, __VA_ARGS__) |
||
71 | #define ERROR(...) fprintf(stderr, "ERROR: "__VA_ARGS__) |
||
72 | #define WARN(...) fprintf(stderr, "WARN: "__VA_ARGS__) |
||
73 | #define DEBUG(...) do {\ |
||
74 | if (debug) \ |
||
75 | fprintf(stdout, "DEBUG: "__VA_ARGS__); \ |
||
76 | } while (0); |
||
77 | |||
78 | #endif |