aboutsummaryrefslogtreecommitdiff
path: root/source/tools/host/go/cnclib/miller_consts.go
blob: 388c25cee0da0ff3ea9b8714df8cec6f770b10be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package miller

import (
    "fmt"
)


const KEY_256 uint8 = (256/8)
const MARKER_SIZ uint8 = 8
const AESKEY_SIZ uint8 = 32
const HW_PROFILE_GUIDLEN uint8 = 39
const MAX_PROFILE_LEN uint8 = 80

const RF_INITIAL uint8 = 0x00
const RF_AGAIN   uint8 = 0x41
const RF_ERROR   uint8 = 0x42
const RF_OK      uint8 = 0x66

const RC_INFO     uint16 = 0xACAB
const RC_REGISTER uint16 = 0xAABB
const RC_PING     uint16 = 0x0043
const RC_SHELL    uint16 = 0x0044

func RCtoString(rc uint16) string {
    switch rc {
        case RC_INFO:
            return "RC_INFO"
        case RC_REGISTER:
            return "RC_REGISTER"
        case RC_PING:
            return "RC_PING"
        case RC_SHELL:
            return "RC_SHELL"
        default:
            return "UNKNOWN"
    }
}

type HttpResp struct {
    StartMarker [MARKER_SIZ]byte
    RespFlags   uint8
    RespCode    uint16
    Pkgsiz      uint32
    Pkgbuf      []byte
}

func (hr *HttpResp) String() string {
    return fmt.Sprintf("Marker: '%s', Flags: 0x%04X, Code: 0x%04X, " +
                       "PKGSIZ: 0x%04X, PKGBUF: '%v'",
        hr.StartMarker, hr.RespFlags, hr.RespCode,
        hr.Pkgsiz, hr.Pkgbuf)
}

type RespRegister struct {
    Aeskey     [AESKEY_SIZ]byte
    NextPing   uint32
}

type RespPong struct {
    NextPing   uint32
}

type RespShell struct {
    Operation   uint8
    Showcmd     uint8
    FileLen     uint16
    ParamLen    uint16
    DirLen      uint16
    Data        []byte
}

type SYSTEM_INFO_32 struct {
    ProcessorArchitecture     uint16
    Reserved                  uint16
    PageSize                  uint32
    MinimumApplicationAddress uint32
    MaximumApplicationAddress uint32
    ActiveProcessorMask       uint32
    NumberOfProcessors        uint32
    ProcessorType             uint32
    AllocationGranularity     uint32
    ProcessorLevel            uint16
    ProcessorRevision         uint16
}

type HW_PROFILE_INFOA struct {
    DockInfo      uint32
    HwProfileGuid [HW_PROFILE_GUIDLEN]byte
    HwProfileName [MAX_PROFILE_LEN]byte
}

type ReqInfo struct {
    SI          SYSTEM_INFO_32
    HW          HW_PROFILE_INFOA
    CmdLineLen  uint16
    DevsLen     uint8
    Data        []byte
}