aboutsummaryrefslogtreecommitdiffstats
path: root/vm/proxyapp/proxyrpc/proxyrpc.go
blob: 10c81f9c222614c31e2fe426a9c468a3637c2eb2 (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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Copyright 2022 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

package proxyrpc

// ProxyAppInterface is the interface you need to implement.
type ProxyAppInterface interface {
	CreatePool(in CreatePoolParams, out *CreatePoolResult) error
	CreateInstance(in CreateInstanceParams, out *CreateInstanceResult) error
	Diagnose(in DiagnoseParams, out *DiagnoseReply) error
	Copy(in CopyParams, out *CopyResult) error
	Forward(in ForwardParams, out *ForwardResult) error
	RunStart(in RunStartParams, out *RunStartReply) error
	RunStop(in RunStopParams, out *RunStopReply) error
	RunReadProgress(in RunReadProgressParams, out *RunReadProgressReply) error
	Close(in CloseParams, out *CloseReply) error
	PoolLogs(in PoolLogsParam, out *PoolLogsReply) error
}

type CreatePoolParams struct {
	Debug     bool
	Param     string
	Image     string
	ImageData []byte
}

type CreatePoolResult struct {
	Count int // signal the created pool size
}

type CreateInstanceParams struct {
	Workdir     string
	Index       int
	WorkdirData map[string][]byte
}

type CreateInstanceResult struct {
	ID string // allocated instance id
}

type CopyParams struct {
	ID      string
	HostSrc string
	Data    []byte
}

type CopyResult struct {
	VMFileName string
}

type ForwardParams struct {
	ID   string
	Port int
}

type ForwardResult struct {
	ManagerAddress string
}

type RunStartParams struct {
	ID      string
	Command string
}

type RunStartReply struct {
	RunID string
}

type RunStopParams struct {
	ID    string
	RunID string
}

type RunStopReply struct {
}

type RunReadProgressParams struct {
	ID    string
	RunID string
}

type RunReadProgressReply struct {
	StdoutChunk     string
	StderrChunk     string
	ConsoleOutChunk string
	Error           string
	Finished        bool
}

type CloseParams struct {
	ID string
}

type CloseReply struct {
}

type DiagnoseParams struct {
	ID          string
	ReasonTitle string
}

type DiagnoseReply struct {
	Diagnosis string
}

type PoolLogsParam struct {
}

type PoolLogsReply struct {
	Log string
	// Verbosity follows pkg/log rules.
	// Messages with Verbosity 0 are printed by default.
	// The higher is this value - the lower is importance of the message.
	Verbosity int
}