1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements.  See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership.  The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License.  You may obtain a copy of the License at
8 //
9 //   http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied.  See the License for the
15 // specific language governing permissions and limitations
16 // under the License.
17 
18 use serde::{Serialize, Deserialize};
19 pub use serde_json;
20 
21 #[derive(Serialize, Deserialize, Debug, Copy, Clone)]
22 pub enum Command {
23     Hello,
24     Bye,
25     Unknown,
26 }
27 
28 #[derive(Serialize, Deserialize, Debug)]
29 pub struct EnclaveInput {
30     pub command: Command,
31     pub message: String
32 }
33 
34 #[derive(Serialize, Deserialize, Debug)]
35 pub struct EnclaveOutput {
36     pub message: String
37 }
38 
39 impl From<u32> for Command {
40     #[inline]
from(value: u32) -> Command41     fn from(value: u32) -> Command {
42         match value {
43             0 => Command::Hello,
44             1 => Command::Bye,
45             _ => Command::Unknown,
46         }
47     }
48 }
49 
50 
51 pub const UUID: &str = &include_str!(concat!(env!("OUT_DIR"), "/uuid.txt"));
52