-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin_request.proto
More file actions
125 lines (110 loc) · 4.2 KB
/
plugin_request.proto
File metadata and controls
125 lines (110 loc) · 4.2 KB
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
116
117
118
119
120
121
122
123
124
125
//
// CPAD server messaging
// Phase 2: apex code insertion
//
// Copyright © 2017 Nagravision
//
syntax = "proto3";
package cpad.insns;
/* --------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------- */
// ===============================
// Version management messages
// ===============================
// VersionRequest message is sent by plugin client at its very startup
// for allowing to check interfaces compatibility between plugin client
// and CPAD server.
// Server respond with a VersionResponse message
// Simple rule could be: a mismatch on major version implies server and
// client being not compatible.
message VersionRequest
{
// The client minor version
uint32 client_version_minor = 10;
// The client major version
uint32 client_version_major = 20;
// A client provider name (informative)
string client_provider_name = 30;
}
// VersionResponse message is sent back by server to plugin client in
// response to a VersionRequest message.
// Client and server shall both verify their corresponding versions matches
// and will allow to implement a valid communication.
// Compatibility rules still need to be defined at time of writing...
message VersionResponse
{
// Server minor version
uint32 server_version_minor = 10;
// Server major version
uint32 server_version_major = 20;
// Server provider name (informative)
string server_provider_name = 30;
}
/* --------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------- */
// ====================================
// Insertion Points management messages
// ====================================
// InsetionLocation are semantically describing all possible locations
// the CPAD tool could insert statements.
// The set of locations modified by CPAD is security model dependent.
enum InsertionLocation
{
// Insert at the begginning of the first basic block of a function
FUNCTION_ENTRY_BLOCK = 0;
// Insert just before a call
FUNCTION_BEFORE_CALL = 5;
// Insert just after a call
FUNCTION_AFTER_CALL = 10;
// Insert at end of a function, just before exit/return
FUNCTION_EXIT_BLOCK = 15;
// Insert at the begginning of a basic block
BASIC_BLOCK_ENTRY = 20;
// Insert at the end of a basic block
BASIC_BLOCK_EXIT = 25;
}
// InsertionPointRequest message is sent by the plugin client to notify CPAD
// that a possible insertion point was reach by the compilation at a specific
// pass. CPAD shall answer if insertion is required or not and if required,
// shall provide the assembler statements to insert.
// The statement to insert is a GCC __asm__ statement with inputs, outputs,
// clobbers and labels. Plugin will process this statement in order to insert
// corresponding insns.
// Actually the choosen compilation pass should accept asm statement insertion
// as it, for simpler plugin implementation.
message InsertionPointRequest
{
// Compilation unit name
string cunit_name = 10;
// Current function name
string cfun_name = 20;
// Semantic desciption of the location
InsertionLocation location = 30;
}
// InsertionPointResponse message is sent back by server as a response to plugin
// request InsertionPointRequest.
// It contains a boolean for granting/denying asm statement insertion, and, if
// granted, the asm statement to insert.
message InsertionPointResponse
{
// Boolean for allowing/refusing insertion
bool insert_asm_statement = 10;
// If allowed, this is the asm statement to insert
string asm_statement = 20;
}
/* --------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------- */
// ============
// RPC services
// ============
//
// Declare RPC services
// In protobuf rpc service is let open. It is up to us to define an underlying RPC mechanism
// that will be used for calling a remote method.
// gprc is such a service (http://grpc.io) in version v1.2.0
//
service PluginServices
{
rpc VersionService (VersionRequest) returns (VersionResponse) {};
rpc InsertionPointService (InsertionPointRequest) returns (InsertionPointResponse) {};
}