Fixed /exec input stream and /signal.
[src/xds/xds-agent.git] / lib / xaapiv1 / exec.go
1 package xaapiv1
2
3 type (
4         // ExecArgs JSON parameters of /exec command
5         ExecArgs struct {
6                 ID              string   `json:"id" binding:"required"`
7                 SdkID           string   `json:"sdkID"` // sdk ID to use for setting env
8                 CmdID           string   `json:"cmdID"` // command unique ID
9                 Cmd             string   `json:"cmd" binding:"required"`
10                 Args            []string `json:"args"`
11                 Env             []string `json:"env"`
12                 RPath           string   `json:"rpath"`           // relative path into project
13                 TTY             bool     `json:"tty"`             // Use a tty, specific to gdb --tty option
14                 TTYGdbserverFix bool     `json:"ttyGdbserverFix"` // Set to true to activate gdbserver workaround about inferior output
15                 ExitImmediate   bool     `json:"exitImmediate"`   // when true, exit event sent immediately when command exited (IOW, don't wait file synchronization)
16                 CmdTimeout      int      `json:"timeout"`         // command completion timeout in Second
17         }
18
19         // ExecResult JSON result of /exec command
20         ExecResult struct {
21                 Status string `json:"status"` // status OK
22                 CmdID  string `json:"cmdID"`  // command unique ID
23         }
24
25         // ExecSignalResult JSON result of /signal command
26         ExecSignalResult struct {
27                 Status string `json:"status"` // status OK
28                 CmdID  string `json:"cmdID"`  // command unique ID
29         }
30
31         // ExecInMsg Message used to received input characters (stdin)
32         ExecInMsg struct {
33                 CmdID     string `json:"cmdID"`
34                 Timestamp string `json:"timestamp"`
35                 Stdin     string `json:"stdin"`
36         }
37
38         // ExecOutMsg Message used to send output characters (stdout+stderr)
39         ExecOutMsg struct {
40                 CmdID     string `json:"cmdID"`
41                 Timestamp string `json:"timestamp"`
42                 Stdout    string `json:"stdout"`
43                 Stderr    string `json:"stderr"`
44         }
45
46         // ExecExitMsg Message sent when executed command exited
47         ExecExitMsg struct {
48                 CmdID     string `json:"cmdID"`
49                 Timestamp string `json:"timestamp"`
50                 Code      int    `json:"code"`
51                 Error     error  `json:"error"`
52         }
53
54         // ExecSignalArgs JSON parameters of /exec/signal command
55         ExecSignalArgs struct {
56                 CmdID  string `json:"cmdID" binding:"required"`  // command id
57                 Signal string `json:"signal" binding:"required"` // signal number
58         }
59 )
60
61 const (
62         // ExecInEvent Event send in WS when characters are sent (stdin)
63         ExecInEvent = "exec:input"
64
65         // ExecOutEvent Event send in WS when characters are received (stdout or stderr)
66         ExecOutEvent = "exec:output"
67
68         // ExecExitEvent Event send in WS when program exited
69         ExecExitEvent = "exec:exit"
70
71         // ExecInferiorInEvent Event send in WS when characters are sent to an inferior (used by gdb inferior/tty)
72         ExecInferiorInEvent = "exec:inferior-input"
73
74         // ExecInferiorOutEvent Event send in WS when characters are received by an inferior
75         ExecInferiorOutEvent = "exec:inferior-output"
76 )