netboot.h (1089B)
1 // Copyright 2022, Brian Swetland <swetland@frotz.net> 2 // Licensed under the Apache License, Version 2.0 3 4 #pragma once 5 6 #include <stdint.h> 7 8 #define NB_PORT_QUERY 58571 9 #define NB_PORT_CTRL 58572 10 11 // echo -n netboot.magic | sha256sum | cut -c1-8 12 // commands are similar (netboot.cmd.name) 13 #define NB_MAGIC 0x1e5dae11U 14 15 // host to target commands 16 #define NB_CMD_QUERY 0x56a938e6U // arg=0, db=targetname.ascii 17 #define NB_CMD_WRITE 0x7b639621U // arg=addr, db=bytes 18 #define NB_CMD_READ 0x1c1d1ecfU // arg=addr, reply.db=bytes 19 #define NB_CMD_EXEC 0xbdb9a844U // arg=addr 20 21 // target to host responses 22 #define NB_CMD_STATUS 0x9e68e03bU // arg=status (0=OK) 23 24 // target to multicast messages 25 #define NB_CMD_SYSLOG 0x5a374503U // arg=0, db=logmsgs.ascii 26 27 #define NB_OK 0 28 #define NB_ERR_BADCMD 1 29 #define NB_ERR_PARAM 2 30 31 #define NB_MSG_MIN 16 32 #define NB_MSG_MAX (16 + 1024) 33 #define NB_DATA_MAX 1024 34 35 typedef struct { 36 uint32_t magic; 37 uint32_t cmd; 38 uint32_t seq; 39 uint32_t arg; 40 union { 41 uint8_t db[1024]; 42 uint32_t dw[1024 / 4]; 43 }; 44 } netboot_msg_t; 45