-
Notifications
You must be signed in to change notification settings - Fork 51
/
interfaces.go
48 lines (39 loc) · 2.05 KB
/
interfaces.go
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
package remoteenforcer
import (
"github.com/aporeto-inc/trireme-lib/enforcer/utils/rpcwrapper"
)
const (
// InitEnforcer is string for invoking RPC
InitEnforcer = "RemoteEnforcer.InitEnforcer"
// InitSupervisor is string for invoking RPC
InitSupervisor = "RemoteEnforcer.InitSupervisor"
//Supervise is string for invoking RPC
Supervise = "RemoteEnforcer.Supervise"
//Unenforce is string for invoking RPC
Unenforce = "RemoteEnforcer.Unenforce"
//Unsupervise is string for invoking RPC
Unsupervise = "RemoteEnforcer.Unsupervise"
//Enforce is string for invoking RPC
Enforce = "RemoteEnforcer.Enforce"
// EnforcerExit is string for invoking RPC
EnforcerExit = "RemoteEnforcer.EnforcerExit"
)
// RemoteIntf is the interface implemented by the remote enforcer
type RemoteIntf interface {
// InitEnforcer is a function called from the controller using RPC.
// It intializes data structure required by the remote enforcer
InitEnforcer(req rpcwrapper.Request, resp *rpcwrapper.Response) error
// InitSupervisor is a function called from the controller over RPC. It initializes data structure required by the supervisor
InitSupervisor(req rpcwrapper.Request, resp *rpcwrapper.Response) error
//Supervise This method calls the supervisor method on the supervisor created during initsupervisor
Supervise(req rpcwrapper.Request, resp *rpcwrapper.Response) error
//Unenforce this method calls the unenforce method on the enforcer created from initenforcer
Unenforce(req rpcwrapper.Request, resp *rpcwrapper.Response) error
//Unsupervise This method calls the unsupervise method on the supervisor created during initsupervisor
Unsupervise(req rpcwrapper.Request, resp *rpcwrapper.Response) error
//Enforce this method calls the enforce method on the enforcer created during initenforcer
Enforce(req rpcwrapper.Request, resp *rpcwrapper.Response) error
// EnforcerExit this method is called when we received a killrpocess message from the controller
// This allows a graceful exit of the enforcer
EnforcerExit(req rpcwrapper.Request, resp *rpcwrapper.Response) error
}