Annotation of elwix/tools/ubnt-mkfwimage/fw.h, revision 1.2

1.2     ! misho       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., 51 Franklin Street, Suite 500, Boston, MA 02110.
        !            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: 
        !            28: #define MAGIC_LENGTH   4
        !            29: 
        !            30: typedef struct header {
        !            31:        char magic[MAGIC_LENGTH];
        !            32:        char version[256];
        !            33:        u_int32_t crc;
        !            34:        u_int32_t pad;
        !            35: } __attribute__ ((packed)) header_t;
        !            36: 
        !            37: typedef struct part {
        !            38:        char magic[MAGIC_LENGTH];
        !            39:        char name[16];
        !            40:        char pad[12];
        !            41:        u_int32_t memaddr;
        !            42:        u_int32_t index;
        !            43:        u_int32_t baseaddr;
        !            44:        u_int32_t entryaddr;
        !            45:        u_int32_t data_size;
        !            46:        u_int32_t part_size;
        !            47: } __attribute__ ((packed)) part_t;
        !            48: 
        !            49: typedef struct part_crc {
        !            50:        u_int32_t crc;
        !            51:        u_int32_t pad;
        !            52: } __attribute__ ((packed)) part_crc_t;
        !            53: 
        !            54: typedef struct signature {
        !            55:        char magic[MAGIC_LENGTH];
        !            56:        u_int32_t crc;
        !            57:        u_int32_t pad;
        !            58: } __attribute__ ((packed)) signature_t;
        !            59: 
        !            60: #define VERSION "1.2"
        !            61: 
        !            62: #define INFO(...) fprintf(stdout, __VA_ARGS__)
        !            63: #define ERROR(...) fprintf(stderr, "ERROR: "__VA_ARGS__)
        !            64: #define WARN(...) fprintf(stderr, "WARN: "__VA_ARGS__)
        !            65: #define DEBUG(...) do {\
        !            66:         if (debug) \
        !            67:                 fprintf(stdout, "DEBUG: "__VA_ARGS__); \
        !            68: } while (0);
        !            69: 
        !            70: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>