sen-ether-client 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,274 @@
1
+ import "stl/sen/kernel/log.stl"
2
+
3
+ package sen.kernel;
4
+
5
+ // Thread execution priorities
6
+ enum Priority: u32
7
+ {
8
+ lowest, // for background work
9
+ nominalMin, // minimum priority for user threads
10
+ nominalMax, // maximum priority for user threads
11
+ highest // supervisory work
12
+ }
13
+
14
+ // What can go wrong when creating a thread
15
+ enum ThreadCreateErr: u32
16
+ {
17
+ schedulerAlreadyStarted, // threads cannot be created after the scheduler spins up
18
+ invalidStackSize, // not all stack sizes are possible in all environments
19
+ invalidThreadFunction, // the thread function was null
20
+ invalidThreadFunctionArgument, // the thread function argument is mandatory
21
+ invalidAffinity, // support for affinity is system dependant
22
+ tooManyThreads, // thread count is limited
23
+ internalOsError // when the OS indicates not enough resources
24
+ }
25
+
26
+ // Native processor word size
27
+ enum WordSize: u32
28
+ {
29
+ bits32, // 32-bit processor
30
+ bits64, // 64-bit processor
31
+ }
32
+
33
+ // Status of git
34
+ enum GitStatus: u8
35
+ {
36
+ clean, // files have not changed
37
+ modified, // local files differ from branch
38
+ unknown // no information
39
+ }
40
+
41
+ // Build-related information
42
+ struct BuildInfo
43
+ {
44
+ maintainer : string, // principal maintainer of the software
45
+ version : string, // version string (format-agnostic)
46
+ compiler : string, // vendor-specific compiler string
47
+ debugMode : bool, // compiled in debug mode or not
48
+ buildTime : string, // when did this build took place
49
+ wordSize : WordSize, // architecture
50
+ gitRef : string, // git ref spec
51
+ gitHash : string, // git hash
52
+ gitStatus : GitStatus // git status
53
+ }
54
+
55
+ // Basic information of a kernel component
56
+ struct ComponentInfo
57
+ {
58
+ name : string,
59
+ description : string,
60
+ buildInfo : BuildInfo
61
+ }
62
+
63
+ // Component queue eviction policy
64
+ enum QueueEvictionPolicy: u32
65
+ {
66
+ dropOldest, // when full, drop the least recent element
67
+ dropNewest, // when full, drop the most recent element
68
+ }
69
+
70
+ struct QueueConfig
71
+ {
72
+ evictionPolicy : QueueEvictionPolicy, // what to do when the queue is full
73
+ maxSize : u64 // 0 means unbounded
74
+ }
75
+
76
+ // Use the native system sleep
77
+ struct SystemSleep;
78
+
79
+ // Be more precise at the expense of some CPU cycles.
80
+ struct PrecisionSleep
81
+ {
82
+ veryCoarseGrainSleepTime : Duration, // First set of sleeps. If 0 defaults to 7ms
83
+ coarseGrainSleepTime : Duration // Second set of sleeps. If 0 defaults to 1ms
84
+ }
85
+
86
+ // Component sleep policy
87
+ variant SleepPolicy
88
+ {
89
+ PrecisionSleep,
90
+ SystemSleep
91
+ }
92
+
93
+ // Basic runtime configuration for a component
94
+ struct ComponentConfig
95
+ {
96
+ priority : Priority, // thread priority
97
+ stackSize : u32, // thread stack size in bytes, 0 means default
98
+ group : u32, // the group where to run the component
99
+ cpuAffinity : u64, // CPU affinity mask
100
+ inQueue : QueueConfig, // queuing of inbound information
101
+ outQueue : QueueConfig, // queuing of outbound information
102
+ sleepPolicy : SleepPolicy // configurable component sleep policy
103
+ }
104
+
105
+ // Category of a problem during component execution
106
+ enum ErrorCategory: u8
107
+ {
108
+ runtimeError, // same semantics of std::runtime_error
109
+ logicError, // faulty logic such as violating logical preconditions or invariants
110
+ expectationsNotMet, // expectations on inputs or internal state were not met
111
+ ioError, // problem while performing an I/O operation
112
+ other // any other reason
113
+ }
114
+
115
+ // An operation is complete
116
+ struct OpFinished;
117
+
118
+ // An operation is not complete
119
+ struct OpNotFinished
120
+ {
121
+ waitHint : Duration // How long to wait until the next try
122
+ }
123
+
124
+ // The status of an operation
125
+ variant OpState
126
+ {
127
+ OpFinished, // done
128
+ OpNotFinished // not done
129
+ }
130
+
131
+ // Holds details of an execution error
132
+ struct ExecError
133
+ {
134
+ category : ErrorCategory, // general problem
135
+ explanation : string // human-readable explanation
136
+ }
137
+
138
+ // State of a kernel component
139
+ enum ComponentState: u8
140
+ {
141
+ unloaded,
142
+ preloaded,
143
+ loading,
144
+ loaded,
145
+ initializing,
146
+ initialized,
147
+ running,
148
+ stopping,
149
+ stopped,
150
+ unloading,
151
+ error
152
+ }
153
+
154
+ // Unbounded sequence of strings for general purpose
155
+ sequence<string> StringList;
156
+
157
+ // Run modes for the kernel
158
+ enum RunMode: u8
159
+ {
160
+ realTime, // components execute using system time
161
+ virtualTime, // components execute using discrete steps (set by the user)
162
+ virtualTimeRunning, // same as virtualTime, but continuously advancing the time
163
+ startAndStop, // starts and stops (useful for smoke tests)
164
+ }
165
+
166
+ // Parameters to configure kernel execution
167
+ struct KernelParams
168
+ {
169
+ runMode : RunMode, // how to run the kernel
170
+ appName : string, // optional name of the application
171
+ bus : string, // where to publish the kernel objects (defaults to local.kernel)
172
+ clockBus : string, // where to publish the virtual clock (if any), defaults to bus
173
+ clockName : string, // the name of the virtual clock (if any), defaults to 'clock'
174
+ clockMaster : bool, // if time is virtualized, publish a master clock to clockBus
175
+ logConfig : sen.kernel.log.Config, // logging configuration
176
+ crashReportDir : string, // where to store crash reports (defaults to the temp dir)
177
+ crashReportDisabled : bool, // if true, no reports are generated
178
+ lockMemoryPages : bool, // keep process pages memory-resident
179
+ sleepPolicy : SleepPolicy // configurable sleep policy of the kernel component
180
+ }
181
+
182
+ // Type of operating system
183
+ enum OsKind : u8
184
+ {
185
+ windowsOs, // Microsoft Windows
186
+ linuxOs, // Linux
187
+ androidOs, // Android Linux
188
+ appleOs, // Apple OS (iOS, tvOS, etc..)
189
+ unixOs, // all unices not caught above
190
+ posixOs, // Posix
191
+ otherOs // other, unknown
192
+ }
193
+
194
+ // Type of CPU
195
+ enum CpuArch : u8
196
+ {
197
+ x86, // x86
198
+ x64, // x86_64
199
+ arm2, // ARM2
200
+ arm3, // ARM3
201
+ arm4T, // ARM4T
202
+ arm5, // ARM5
203
+ arm6T2, // ARM6T2
204
+ arm6, // ARM6
205
+ arm7, // ARM7
206
+ arm7a, // ARM7A
207
+ arm7r, // ARM7R
208
+ arm7s, // ARM7S
209
+ arm64, // ARM64
210
+ mips, // MIPS
211
+ superH, // SUPERH
212
+ ppc, // PowerPC
213
+ ppc64, // PowerPC64
214
+ sparc, // Sparc
215
+ m68k, // Motorola 68000
216
+ otherArch // other, unknown
217
+ }
218
+
219
+ // Basic information about a process
220
+ struct ProcessInfo
221
+ {
222
+ hostId : u32,
223
+ processId : u32,
224
+ sessionId : u32,
225
+ sessionName : string,
226
+ appName : string,
227
+ hostName : string,
228
+ osKind : OsKind,
229
+ osName : string,
230
+ cpuArch : CpuArch
231
+ }
232
+
233
+ // Unbounded sequence of ProcessInfo
234
+ sequence<ProcessInfo> Processes;
235
+
236
+ // Address to connect to a bus
237
+ struct BusAddress
238
+ {
239
+ sessionName : string,
240
+ busName : string
241
+ }
242
+
243
+ // A general-purpose unbounded buffer
244
+ sequence<u8> Buffer;
245
+
246
+ // Type of measurement
247
+ enum UnitCat: u8
248
+ {
249
+ length,
250
+ mass,
251
+ time,
252
+ angle,
253
+ temperature,
254
+ frequency,
255
+ velocity,
256
+ angularVelocity,
257
+ acceleration,
258
+ angularAcceleration,
259
+ density,
260
+ pressure,
261
+ area,
262
+ force,
263
+ torque
264
+ }
265
+
266
+ // Describes a unit
267
+ struct UnitInfo
268
+ {
269
+ name : string,
270
+ abbreviation : string,
271
+ category : UnitCat
272
+ }
273
+
274
+ sequence<u32> U32List;
@@ -0,0 +1,198 @@
1
+ import "stl/sen/kernel/basic_types.stl"
2
+ import "stl/sen/kernel/type_specs.stl"
3
+
4
+ // IMPORTANT NOTE: Types defined in this file CANNOT be erased, as we need to keep track of older versions to ensure
5
+ // runtime compatibility. Older versions are marked with a suffix V# after the name, being # the KernelProtocolVersion.
6
+
7
+ package sen.kernel;
8
+
9
+ // Used between remote participants to detect each other before sharing their interests. This prevents interests from
10
+ // being lost in the communication
11
+ struct RemoteParticipantReady
12
+ {
13
+ id : u32
14
+ }
15
+
16
+ // Sends an interest between processes to request notification of eventual object additions in the remote process that
17
+ // satisfy the query
18
+ struct InterestStarted
19
+ {
20
+ query : string,
21
+ id : u32
22
+ }
23
+
24
+ struct InterestStopped
25
+ {
26
+ id : u32
27
+ }
28
+
29
+ // Notifies an object addition between processes. It also contains the static state (values of static properties)
30
+ struct ObjectAdded
31
+ {
32
+ className : string,
33
+ typeHash : u32,
34
+ name : string,
35
+ id : u32,
36
+ state : Buffer,
37
+ time : TimeStamp
38
+ }
39
+
40
+ sequence<ObjectAdded> ObjectAddedList;
41
+
42
+ struct InterestDiscovery
43
+ {
44
+ interestId : u32,
45
+ objects : ObjectAddedList
46
+ }
47
+
48
+ sequence<InterestDiscovery> InterestDiscoveryList;
49
+
50
+ struct InterestObjectRemoval
51
+ {
52
+ interestId : u32,
53
+ ids : U32List
54
+ }
55
+
56
+ sequence<InterestObjectRemoval> InterestObjectRemovalList;
57
+
58
+ struct ObjectsPublished
59
+ {
60
+ ownerId : u32,
61
+ discoveries : InterestDiscoveryList
62
+ }
63
+
64
+ struct ObjectsRemoved
65
+ {
66
+ removals : InterestObjectRemovalList
67
+ }
68
+
69
+ struct RepeatedName
70
+ {
71
+ myObjectRegistrationTime : TimeStamp
72
+ }
73
+
74
+ struct RuntimeIncompatibleType
75
+ {
76
+ }
77
+
78
+ struct Timeout
79
+ {
80
+ }
81
+
82
+ variant PublicationRejectionReason
83
+ {
84
+ RepeatedName,
85
+ RuntimeIncompatibleType,
86
+ Timeout
87
+ }
88
+
89
+ struct ObjectPublicationRejected
90
+ {
91
+ objectId : u32,
92
+ interestId : u32,
93
+ reason : PublicationRejectionReason
94
+ }
95
+
96
+ sequence<ObjectPublicationRejected> RejectionList;
97
+
98
+ struct PublicationRejection
99
+ {
100
+ rejections : RejectionList
101
+ }
102
+
103
+ sequence<u32> SpecRequestList;
104
+ sequence<u32> TypeHashList;
105
+
106
+ struct ClassSpecResponse
107
+ {
108
+ classHash : u32,
109
+ spec : CustomTypeSpec,
110
+ dependentTypes : TypeHashList
111
+ }
112
+
113
+ struct NonClassSpecResponse
114
+ {
115
+ spec : CustomTypeSpec,
116
+ }
117
+
118
+ variant TypeSpecResponse
119
+ {
120
+ ClassSpecResponse,
121
+ NonClassSpecResponse
122
+ }
123
+
124
+ sequence<TypeSpecResponse> TypeSpecResponseList;
125
+
126
+ struct TypesInfoRequest
127
+ {
128
+ ownerId : u32,
129
+ requests : SpecRequestList
130
+ }
131
+
132
+ struct TypesInfoResponse
133
+ {
134
+ ownerId : u32,
135
+ types : TypeSpecResponseList
136
+ }
137
+
138
+ struct TypesInfoRejection
139
+ {
140
+ ownerId : u32,
141
+ rejections : StringList
142
+ }
143
+
144
+ sequence<u32> ObjectIdList;
145
+
146
+ struct ObjectIdsByInterest
147
+ {
148
+ interestId : u32,
149
+ objectIds : ObjectIdList
150
+ }
151
+
152
+ sequence<ObjectIdsByInterest> ObjectIdsByInterestList;
153
+
154
+ struct ObjectsStateRequest
155
+ {
156
+ ownerId : u32,
157
+ requests : ObjectIdsByInterestList
158
+ }
159
+
160
+ // Contains the dynamic state of an object that was published in a remote process. Used to update the object before
161
+ // the remote participant publishes it locally
162
+ struct ObjectState
163
+ {
164
+ id : u32,
165
+ timestamp : TimeStamp,
166
+ state : Buffer,
167
+ }
168
+
169
+ sequence <ObjectState> ObjectStateList;
170
+
171
+ struct ObjectStatesByInterest
172
+ {
173
+ interestId : u32,
174
+ objectStates : ObjectStateList
175
+ }
176
+
177
+ sequence<ObjectStatesByInterest> ObjectStatesByInterestList;
178
+
179
+ struct ObjectsStateResponse
180
+ {
181
+ ownerId : u32,
182
+ responses : ObjectStatesByInterestList
183
+ }
184
+
185
+ variant ControlMessage
186
+ {
187
+ RemoteParticipantReady,
188
+ InterestStarted,
189
+ InterestStopped,
190
+ ObjectsPublished,
191
+ ObjectsRemoved,
192
+ PublicationRejection,
193
+ ObjectsStateRequest,
194
+ ObjectsStateResponse,
195
+ TypesInfoRequest,
196
+ TypesInfoResponse,
197
+ TypesInfoRejection
198
+ }