You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by ms...@apache.org on 2020/01/06 23:50:06 UTC
[incubator-teaclave] branch develop updated (db07f80 -> 9a5c436)
This is an automated email from the ASF dual-hosted git repository.
mssun pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git.
from db07f80 Tidy Cargo.toml
new dc4475a [services] Use single proto project to manage all services protocols
new 954aa86 [services] Rename teaclave_frontend to teaclave_frontend_service and simplify directory names
new 9a5c436 [rpc] Remove Read/Write trait of transport
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
cmake/tomls/Cargo.sgx_trusted_lib.toml | 2 +-
cmake/tomls/Cargo.sgx_untrusted_app.toml | 2 +-
rpc/src/channel.rs | 3 +-
rpc/src/server.rs | 5 +-
rpc/src/transport.rs | 40 ++-----------
.../sgx_app => frontend/app}/Cargo.toml | 4 +-
.../sgx_app => frontend/app}/build.rs | 0
.../sgx_app => frontend/app}/src/main.rs | 0
.../enclave}/Cargo.toml | 10 ++--
.../enclave}/Enclave.config.xml | 0
.../enclave}/src/lib.rs | 2 +-
.../enclave}/src/service.rs | 6 +-
services/{teaclave_frontend => }/proto/Cargo.toml | 8 +--
services/{teaclave_frontend => }/proto/build.rs | 9 ++-
services/{ => proto}/proto_gen/Cargo.toml | 0
services/{ => proto}/proto_gen/main.rs | 0
services/{ => proto}/proto_gen/templates/proto.j2 | 4 +-
services/proto/src/lib.rs | 68 ++++++++++++++++++++++
.../src/proto}/teaclave_frontend.proto | 0
services/proto/src/teaclave_frontend.rs | 51 ++++++++++++++++
services/teaclave_frontend/proto/src/lib.rs | 66 ---------------------
services/teaclave_frontend/proto/src/proto.rs | 3 -
utils/service_enclave_utils/proc_macro/src/lib.rs | 4 +-
23 files changed, 153 insertions(+), 134 deletions(-)
rename services/{teaclave_frontend/sgx_app => frontend/app}/Cargo.toml (88%)
rename services/{teaclave_frontend/sgx_app => frontend/app}/build.rs (100%)
rename services/{teaclave_frontend/sgx_app => frontend/app}/src/main.rs (100%)
rename services/{teaclave_frontend/sgx_trusted_lib => frontend/enclave}/Cargo.toml (84%)
rename services/{teaclave_frontend/sgx_trusted_lib => frontend/enclave}/Enclave.config.xml (100%)
rename services/{teaclave_frontend/sgx_trusted_lib => frontend/enclave}/src/lib.rs (97%)
rename services/{teaclave_frontend/sgx_trusted_lib => frontend/enclave}/src/service.rs (83%)
rename services/{teaclave_frontend => }/proto/Cargo.toml (83%)
rename services/{teaclave_frontend => }/proto/build.rs (86%)
rename services/{ => proto}/proto_gen/Cargo.toml (100%)
rename services/{ => proto}/proto_gen/main.rs (100%)
rename services/{ => proto}/proto_gen/templates/proto.j2 (94%)
create mode 100644 services/proto/src/lib.rs
rename services/{teaclave_frontend/proto/src => proto/src/proto}/teaclave_frontend.proto (100%)
create mode 100644 services/proto/src/teaclave_frontend.rs
delete mode 100644 services/teaclave_frontend/proto/src/lib.rs
delete mode 100644 services/teaclave_frontend/proto/src/proto.rs
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org
[incubator-teaclave] 02/03: [services] Rename teaclave_frontend to
teaclave_frontend_service and simplify directory names
Posted by ms...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
mssun pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git
commit 954aa86a5d93d9dff33b1530b5e06cf9fcd848a4
Author: Mingshen Sun <bo...@mssun.me>
AuthorDate: Mon Jan 6 15:27:45 2020 -0800
[services] Rename teaclave_frontend to teaclave_frontend_service and simplify directory names
---
cmake/tomls/Cargo.sgx_trusted_lib.toml | 2 +-
cmake/tomls/Cargo.sgx_untrusted_app.toml | 2 +-
services/{teaclave_frontend/sgx_app => frontend/app}/Cargo.toml | 4 ++--
services/{teaclave_frontend/sgx_app => frontend/app}/build.rs | 0
services/{teaclave_frontend/sgx_app => frontend/app}/src/main.rs | 0
.../sgx_trusted_lib => frontend/enclave}/Cargo.toml | 6 +++---
.../sgx_trusted_lib => frontend/enclave}/Enclave.config.xml | 0
.../sgx_trusted_lib => frontend/enclave}/src/lib.rs | 0
.../sgx_trusted_lib => frontend/enclave}/src/service.rs | 0
9 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/cmake/tomls/Cargo.sgx_trusted_lib.toml b/cmake/tomls/Cargo.sgx_trusted_lib.toml
index ffa12f3..133c422 100644
--- a/cmake/tomls/Cargo.sgx_trusted_lib.toml
+++ b/cmake/tomls/Cargo.sgx_trusted_lib.toml
@@ -1,7 +1,7 @@
[workspace]
members = [
- "services/teaclave_frontend/sgx_trusted_lib",
+ "services/frontend/enclave",
]
exclude = [
diff --git a/cmake/tomls/Cargo.sgx_untrusted_app.toml b/cmake/tomls/Cargo.sgx_untrusted_app.toml
index 450a9a9..c743d64 100644
--- a/cmake/tomls/Cargo.sgx_untrusted_app.toml
+++ b/cmake/tomls/Cargo.sgx_untrusted_app.toml
@@ -1,7 +1,7 @@
[workspace]
members = [
- "services/teaclave_frontend/sgx_app",
+ "services/frontend/app",
]
exclude = [
diff --git a/services/teaclave_frontend/sgx_app/Cargo.toml b/services/frontend/app/Cargo.toml
similarity index 88%
rename from services/teaclave_frontend/sgx_app/Cargo.toml
rename to services/frontend/app/Cargo.toml
index 7d0a482..faf6895 100644
--- a/services/teaclave_frontend/sgx_app/Cargo.toml
+++ b/services/frontend/app/Cargo.toml
@@ -1,8 +1,8 @@
[package]
-name = "teaclave_frontend"
+name = "teaclave_frontend_service"
version = "0.1.0"
authors = ["Teaclave Contributors <de...@teaclave.apache.org>"]
-description = "Teaclave Frontend"
+description = "Teaclave Frontend Service"
license = "Apache-2.0"
build = "build.rs"
edition = "2018"
diff --git a/services/teaclave_frontend/sgx_app/build.rs b/services/frontend/app/build.rs
similarity index 100%
rename from services/teaclave_frontend/sgx_app/build.rs
rename to services/frontend/app/build.rs
diff --git a/services/teaclave_frontend/sgx_app/src/main.rs b/services/frontend/app/src/main.rs
similarity index 100%
rename from services/teaclave_frontend/sgx_app/src/main.rs
rename to services/frontend/app/src/main.rs
diff --git a/services/teaclave_frontend/sgx_trusted_lib/Cargo.toml b/services/frontend/enclave/Cargo.toml
similarity index 90%
rename from services/teaclave_frontend/sgx_trusted_lib/Cargo.toml
rename to services/frontend/enclave/Cargo.toml
index 7a9219b..cb72798 100644
--- a/services/teaclave_frontend/sgx_trusted_lib/Cargo.toml
+++ b/services/frontend/enclave/Cargo.toml
@@ -1,13 +1,13 @@
[package]
-name = "teaclave_frontend_enclave"
+name = "teaclave_frontend_service_enclave"
version = "0.1.0"
authors = ["Teaclave Contributors <de...@teaclave.apache.org>"]
-description = "Teaclave Frontend enclave"
+description = "Teaclave Frontend Service enclave"
license = "Apache-2.0"
edition = "2018"
[lib]
-name = "teaclave_frontend_enclave"
+name = "teaclave_frontend_service_enclave"
crate-type = ["staticlib"]
[features]
diff --git a/services/teaclave_frontend/sgx_trusted_lib/Enclave.config.xml b/services/frontend/enclave/Enclave.config.xml
similarity index 100%
rename from services/teaclave_frontend/sgx_trusted_lib/Enclave.config.xml
rename to services/frontend/enclave/Enclave.config.xml
diff --git a/services/teaclave_frontend/sgx_trusted_lib/src/lib.rs b/services/frontend/enclave/src/lib.rs
similarity index 100%
rename from services/teaclave_frontend/sgx_trusted_lib/src/lib.rs
rename to services/frontend/enclave/src/lib.rs
diff --git a/services/teaclave_frontend/sgx_trusted_lib/src/service.rs b/services/frontend/enclave/src/service.rs
similarity index 100%
rename from services/teaclave_frontend/sgx_trusted_lib/src/service.rs
rename to services/frontend/enclave/src/service.rs
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org
[incubator-teaclave] 03/03: [rpc] Remove Read/Write trait of
transport
Posted by ms...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
mssun pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git
commit 9a5c436cce3396aff33abe618620a9cb60e0fe54
Author: Mingshen Sun <bo...@mssun.me>
AuthorDate: Mon Jan 6 15:38:39 2020 -0800
[rpc] Remove Read/Write trait of transport
---
rpc/src/channel.rs | 3 +--
rpc/src/server.rs | 5 +----
rpc/src/transport.rs | 40 ++++++----------------------------------
3 files changed, 8 insertions(+), 40 deletions(-)
diff --git a/rpc/src/channel.rs b/rpc/src/channel.rs
index 0514882..0beb858 100644
--- a/rpc/src/channel.rs
+++ b/rpc/src/channel.rs
@@ -29,8 +29,7 @@ mod sgx_trusted_tls {
pub fn new(
stream: rustls::StreamOwned<rustls::ClientSession, std::net::TcpStream>,
) -> SgxTrustedTlsChannel<U, V> {
- let transport =
- SgxTrustedTlsTransport::<rustls::ServerSession>::new_client_with_stream(stream);
+ let transport = SgxTrustedTlsTransport::new(stream);
Self {
transport,
maker: std::marker::PhantomData::<(U, V)>,
diff --git a/rpc/src/server.rs b/rpc/src/server.rs
index f11ed62..752a8d8 100644
--- a/rpc/src/server.rs
+++ b/rpc/src/server.rs
@@ -54,10 +54,7 @@ mod sgx_trusted_tls {
for stream in self.listener.incoming() {
let session = rustls::ServerSession::new(&self.tls_config);
let tls_stream = rustls::StreamOwned::new(session, stream.unwrap());
- let mut transport =
- SgxTrustedTlsTransport::<rustls::ServerSession>::new_server_with_stream(
- tls_stream,
- );
+ let mut transport = SgxTrustedTlsTransport::new(tls_stream);
pool.execute(move || {
let _ = transport.serve(service);
});
diff --git a/rpc/src/transport.rs b/rpc/src/transport.rs
index 1643552..6ad33f9 100644
--- a/rpc/src/transport.rs
+++ b/rpc/src/transport.rs
@@ -47,16 +47,10 @@ mod sgx_trusted_tls {
where
S: rustls::Session,
{
- pub fn new_client_with_stream(
- stream: rustls::StreamOwned<rustls::ClientSession, std::net::TcpStream>,
- ) -> SgxTrustedTlsTransport<rustls::ClientSession> {
- SgxTrustedTlsTransport::<rustls::ClientSession> { stream }
- }
-
- pub fn new_server_with_stream(
- stream: rustls::StreamOwned<rustls::ServerSession, std::net::TcpStream>,
- ) -> SgxTrustedTlsTransport<rustls::ServerSession> {
- SgxTrustedTlsTransport::<rustls::ServerSession> { stream }
+ pub fn new(
+ stream: rustls::StreamOwned<S, std::net::TcpStream>,
+ ) -> SgxTrustedTlsTransport<S> {
+ SgxTrustedTlsTransport::<S> { stream }
}
}
@@ -69,7 +63,7 @@ mod sgx_trusted_tls {
U: Serialize + std::fmt::Debug,
V: for<'de> Deserialize<'de> + std::fmt::Debug,
{
- let mut protocol = protocol::JsonProtocol::new(self);
+ let mut protocol = protocol::JsonProtocol::new(&mut self.stream);
protocol.write_message(request)?;
protocol.read_message()
}
@@ -85,7 +79,7 @@ mod sgx_trusted_tls {
V: for<'de> Deserialize<'de> + std::fmt::Debug,
X: TeaclaveService<V, U>,
{
- let mut protocol = protocol::JsonProtocol::new(self);
+ let mut protocol = protocol::JsonProtocol::new(&mut self.stream);
loop {
debug!("read_message");
@@ -104,28 +98,6 @@ mod sgx_trusted_tls {
}
}
}
-
- impl<S> std::io::Read for SgxTrustedTlsTransport<S>
- where
- S: rustls::Session,
- {
- fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
- self.stream.read(buf)
- }
- }
-
- impl<S> std::io::Write for SgxTrustedTlsTransport<S>
- where
- S: rustls::Session,
- {
- fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
- self.stream.write(buf)
- }
-
- fn flush(&mut self) -> std::io::Result<()> {
- self.stream.flush()
- }
- }
}
#[cfg(not(feature = "mesalock_sgx"))]
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org
[incubator-teaclave] 01/03: [services] Use single proto project to
manage all services protocols
Posted by ms...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
mssun pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git
commit dc4475a72ad11e9a0f536d70b5b10dbda8537d91
Author: Mingshen Sun <bo...@mssun.me>
AuthorDate: Mon Jan 6 14:03:04 2020 -0800
[services] Use single proto project to manage all services protocols
---
services/{teaclave_frontend => }/proto/Cargo.toml | 8 +--
services/{teaclave_frontend => }/proto/build.rs | 9 ++-
services/{ => proto}/proto_gen/Cargo.toml | 0
services/{ => proto}/proto_gen/main.rs | 0
services/{ => proto}/proto_gen/templates/proto.j2 | 4 +-
services/proto/src/lib.rs | 68 ++++++++++++++++++++++
.../src/proto}/teaclave_frontend.proto | 0
services/proto/src/teaclave_frontend.rs | 51 ++++++++++++++++
services/teaclave_frontend/proto/src/lib.rs | 66 ---------------------
services/teaclave_frontend/proto/src/proto.rs | 3 -
.../teaclave_frontend/sgx_trusted_lib/Cargo.toml | 4 +-
.../teaclave_frontend/sgx_trusted_lib/src/lib.rs | 2 +-
.../sgx_trusted_lib/src/service.rs | 6 +-
utils/service_enclave_utils/proc_macro/src/lib.rs | 4 +-
14 files changed, 138 insertions(+), 87 deletions(-)
diff --git a/services/teaclave_frontend/proto/Cargo.toml b/services/proto/Cargo.toml
similarity index 83%
rename from services/teaclave_frontend/proto/Cargo.toml
rename to services/proto/Cargo.toml
index db2de69..0e9bdfa 100644
--- a/services/teaclave_frontend/proto/Cargo.toml
+++ b/services/proto/Cargo.toml
@@ -1,8 +1,8 @@
[package]
-name = "teaclave_frontend_proto"
+name = "teaclave_proto"
version = "0.1.0"
authors = ["Teaclave Contributors <de...@teaclave.apache.org>"]
-description = "RPC protocol of Teaclave Frontend."
+description = "RPC protocol of Teaclave services."
license = "Apache-2.0"
edition = "2018"
@@ -29,5 +29,5 @@ base64 = { version = "0.10.1" }
sgx_cov = { version = "1.1.0", optional = true }
sgx_tstd = { version = "1.1.0", features = ["net", "backtrace"], optional = true }
sgx_types = { version = "1.1.0" }
-teaclave_rpc = { path = "../../../rpc" }
-teaclave_types = { path = "../../../types" }
+teaclave_rpc = { path = "../../rpc" }
+teaclave_types = { path = "../../types" }
diff --git a/services/teaclave_frontend/proto/build.rs b/services/proto/build.rs
similarity index 86%
rename from services/teaclave_frontend/proto/build.rs
rename to services/proto/build.rs
index c13450e..b99d04f 100644
--- a/services/teaclave_frontend/proto/build.rs
+++ b/services/proto/build.rs
@@ -20,22 +20,21 @@ use std::process::Command;
use std::str;
fn main() {
- let pkg_name = env!("CARGO_PKG_NAME");
- let proto_path = format!("src/{}", pkg_name.replace("_proto", ".proto"));
+ let proto_path = format!("src/proto");
let out_dir = env::var("OUT_DIR").expect("$OUT_DIR not set. Please build with cargo");
println!("cargo:rerun-if-changed={}", proto_path);
println!("cargo:rerun-if-changed=build.rs");
- println!("cargo:rerun-if-changed=templates/proto.j2");
+ println!("cargo:rerun-if-changed=proto_gen/templates/proto.j2");
let c = Command::new("cargo")
.args(&[
"run",
"--target-dir",
"/tmp/proto_gen/target",
"--manifest-path",
- "../../proto_gen/Cargo.toml",
+ "./proto_gen/Cargo.toml",
"--",
"-p",
- &proto_path,
+ "src/proto/teaclave_frontend.proto",
"-i",
".",
"-d",
diff --git a/services/proto_gen/Cargo.toml b/services/proto/proto_gen/Cargo.toml
similarity index 100%
rename from services/proto_gen/Cargo.toml
rename to services/proto/proto_gen/Cargo.toml
diff --git a/services/proto_gen/main.rs b/services/proto/proto_gen/main.rs
similarity index 100%
rename from services/proto_gen/main.rs
rename to services/proto/proto_gen/main.rs
diff --git a/services/proto_gen/templates/proto.j2 b/services/proto/proto_gen/templates/proto.j2
similarity index 94%
rename from services/proto_gen/templates/proto.j2
rename to services/proto/proto_gen/templates/proto.j2
index 320f50b..994086f 100644
--- a/services/proto_gen/templates/proto.j2
+++ b/services/proto/proto_gen/templates/proto.j2
@@ -24,13 +24,13 @@ pub enum {{ service.proto_name }}Response {
pub trait {{ service.proto_name }} {
{% for m in service.methods %}
- fn {{ m.name }}(request: crate::{{ m.input_type }}) -> Result<crate::{{ m.output_type }}>;
+ fn {{ m.name }}(request: super::{{ m.input_type }}) -> Result<super::{{ m.output_type }}>;
{% endfor %}
fn dispatch(&self, request: {{ service.proto_name }}Request) -> Result<{{ service.proto_name }}Response> {
match request {
{% for m in service.methods %}
{{ service.proto_name }}Request::{{ m.proto_name }}(request) => {
- let request = crate::{{ m.input_type }}::try_from(request)
+ let request = super::{{ m.input_type }}::try_from(request)
.map_err(|_| TeaclaveServiceError::InternalError("internal".to_string()))?;
let response = Self::{{ m.name }}(request)?;
let response = {{ m.output_type }}::from(response);
diff --git a/services/proto/src/lib.rs b/services/proto/src/lib.rs
new file mode 100644
index 0000000..0251063
--- /dev/null
+++ b/services/proto/src/lib.rs
@@ -0,0 +1,68 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#![cfg_attr(feature = "mesalock_sgx", no_std)]
+#[cfg(feature = "mesalock_sgx")]
+extern crate sgx_tstd as std;
+
+// use anyhow::{Error, Result};
+
+// #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)]
+// pub struct UserLoginRequest {
+// pub id: std::string::String,
+// pub password: std::string::String,
+// }
+
+// #[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)]
+// pub struct UserLoginResponse {
+// pub token: std::string::String,
+// }
+
+// impl std::convert::TryFrom<proto::UserLoginRequest> for UserLoginRequest {
+// type Error = Error;
+
+// fn try_from(proto: crate::proto::UserLoginRequest) -> Result<Self> {
+// let ret = Self {
+// id: proto.id,
+// password: proto.password,
+// };
+
+// Ok(ret)
+// }
+// }
+
+// impl From<UserLoginRequest> for crate::proto::UserLoginRequest {
+// fn from(request: UserLoginRequest) -> Self {
+// Self {
+// id: request.id,
+// password: request.password,
+// }
+// }
+// }
+
+// impl From<UserLoginResponse> for crate::proto::UserLoginResponse {
+// fn from(response: UserLoginResponse) -> Self {
+// Self {
+// token: response.token,
+// }
+// }
+// }
+
+// pub mod proto;
+// pub use proto::TeaclaveFrontend;
+
+pub mod teaclave_frontend;
diff --git a/services/teaclave_frontend/proto/src/teaclave_frontend.proto b/services/proto/src/proto/teaclave_frontend.proto
similarity index 100%
rename from services/teaclave_frontend/proto/src/teaclave_frontend.proto
rename to services/proto/src/proto/teaclave_frontend.proto
diff --git a/services/proto/src/teaclave_frontend.rs b/services/proto/src/teaclave_frontend.rs
new file mode 100644
index 0000000..3be5d72
--- /dev/null
+++ b/services/proto/src/teaclave_frontend.rs
@@ -0,0 +1,51 @@
+use anyhow::{Error, Result};
+
+pub mod proto {
+ #![allow(clippy::all)]
+ include!(concat!(env!("OUT_DIR"), "/teaclave_frontend_proto.rs"));
+}
+
+pub use proto::TeaclaveFrontend;
+pub use proto::TeaclaveFrontendRequest;
+pub use proto::TeaclaveFrontendResponse;
+
+#[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)]
+pub struct UserLoginRequest {
+ pub id: std::string::String,
+ pub password: std::string::String,
+}
+
+#[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)]
+pub struct UserLoginResponse {
+ pub token: std::string::String,
+}
+
+impl std::convert::TryFrom<proto::UserLoginRequest> for UserLoginRequest {
+ type Error = Error;
+
+ fn try_from(proto: proto::UserLoginRequest) -> Result<Self> {
+ let ret = Self {
+ id: proto.id,
+ password: proto.password,
+ };
+
+ Ok(ret)
+ }
+}
+
+impl From<UserLoginRequest> for proto::UserLoginRequest {
+ fn from(request: UserLoginRequest) -> Self {
+ Self {
+ id: request.id,
+ password: request.password,
+ }
+ }
+}
+
+impl From<UserLoginResponse> for proto::UserLoginResponse {
+ fn from(response: UserLoginResponse) -> Self {
+ Self {
+ token: response.token,
+ }
+ }
+}
diff --git a/services/teaclave_frontend/proto/src/lib.rs b/services/teaclave_frontend/proto/src/lib.rs
deleted file mode 100644
index cc549e9..0000000
--- a/services/teaclave_frontend/proto/src/lib.rs
+++ /dev/null
@@ -1,66 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-#![cfg_attr(feature = "mesalock_sgx", no_std)]
-#[cfg(feature = "mesalock_sgx")]
-extern crate sgx_tstd as std;
-
-use anyhow::{Error, Result};
-
-#[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)]
-pub struct UserLoginRequest {
- pub id: std::string::String,
- pub password: std::string::String,
-}
-
-#[derive(serde_derive::Serialize, serde_derive::Deserialize, Debug)]
-pub struct UserLoginResponse {
- pub token: std::string::String,
-}
-
-impl std::convert::TryFrom<proto::UserLoginRequest> for UserLoginRequest {
- type Error = Error;
-
- fn try_from(proto: crate::proto::UserLoginRequest) -> Result<Self> {
- let ret = Self {
- id: proto.id,
- password: proto.password,
- };
-
- Ok(ret)
- }
-}
-
-impl From<UserLoginRequest> for crate::proto::UserLoginRequest {
- fn from(request: UserLoginRequest) -> Self {
- Self {
- id: request.id,
- password: request.password,
- }
- }
-}
-
-impl From<UserLoginResponse> for crate::proto::UserLoginResponse {
- fn from(response: UserLoginResponse) -> Self {
- Self {
- token: response.token,
- }
- }
-}
-
-pub mod proto;
-pub use proto::TeaclaveFrontend;
diff --git a/services/teaclave_frontend/proto/src/proto.rs b/services/teaclave_frontend/proto/src/proto.rs
deleted file mode 100644
index a9745a5..0000000
--- a/services/teaclave_frontend/proto/src/proto.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-#![allow(clippy::all)]
-
-include!(concat!(env!("OUT_DIR"), "/teaclave_frontend_proto.rs"));
diff --git a/services/teaclave_frontend/sgx_trusted_lib/Cargo.toml b/services/teaclave_frontend/sgx_trusted_lib/Cargo.toml
index a733dc8..7a9219b 100644
--- a/services/teaclave_frontend/sgx_trusted_lib/Cargo.toml
+++ b/services/teaclave_frontend/sgx_trusted_lib/Cargo.toml
@@ -15,7 +15,7 @@ default = []
mesalock_sgx = [
"sgx_tstd",
"teaclave_attestation/mesalock_sgx",
- "teaclave_frontend_proto/mesalock_sgx",
+ "teaclave_proto/mesalock_sgx",
"teaclave_ipc/mesalock_sgx",
"teaclave_rpc/mesalock_sgx",
"teaclave_service_config/mesalock_sgx",
@@ -32,7 +32,7 @@ thiserror = { version = "1.0.9" }
teaclave_attestation = { path = "../../../attestation" }
teaclave_config = { path = "../../../config" }
-teaclave_frontend_proto = { path = "../proto" }
+teaclave_proto = { path = "../../proto" }
teaclave_ipc = { path = "../../../ipc" }
teaclave_rpc = { path = "../../../rpc" }
teaclave_service_config = { path = "../../../utils/service_config" }
diff --git a/services/teaclave_frontend/sgx_trusted_lib/src/lib.rs b/services/teaclave_frontend/sgx_trusted_lib/src/lib.rs
index 56e5911..bac086d 100644
--- a/services/teaclave_frontend/sgx_trusted_lib/src/lib.rs
+++ b/services/teaclave_frontend/sgx_trusted_lib/src/lib.rs
@@ -39,7 +39,7 @@ use teaclave_service_config as config;
use teaclave_service_enclave_utils::ServiceEnclave;
use teaclave_attestation::RemoteAttestation;
-use teaclave_frontend_proto::proto::{TeaclaveFrontendRequest, TeaclaveFrontendResponse};
+use teaclave_proto::teaclave_frontend::{TeaclaveFrontendRequest, TeaclaveFrontendResponse};
use teaclave_rpc::config::SgxTrustedTlsServerConfig;
use teaclave_rpc::server::SgxTrustedTlsServer;
diff --git a/services/teaclave_frontend/sgx_trusted_lib/src/service.rs b/services/teaclave_frontend/sgx_trusted_lib/src/service.rs
index bd6745e..3e55c1c 100644
--- a/services/teaclave_frontend/sgx_trusted_lib/src/service.rs
+++ b/services/teaclave_frontend/sgx_trusted_lib/src/service.rs
@@ -1,5 +1,7 @@
use std::prelude::v1::*;
-use teaclave_frontend_proto::{TeaclaveFrontend, UserLoginRequest, UserLoginResponse};
+use teaclave_proto::teaclave_frontend::{
+ self, TeaclaveFrontend, UserLoginRequest, UserLoginResponse,
+};
use teaclave_service_enclave_utils::teaclave_service;
use teaclave_types::TeaclaveServiceError;
@@ -20,7 +22,7 @@ impl From<TeaclaveFrontendError> for TeaclaveServiceError {
}
}
-#[teaclave_service(teaclave_frontend_proto, TeaclaveFrontend, TeaclaveFrontendError)]
+#[teaclave_service(teaclave_frontend, TeaclaveFrontend, TeaclaveFrontendError)]
#[derive(Copy, Clone)]
pub(crate) struct TeaclaveFrontendService;
diff --git a/utils/service_enclave_utils/proc_macro/src/lib.rs b/utils/service_enclave_utils/proc_macro/src/lib.rs
index 7a9f08c..c4b7d23 100644
--- a/utils/service_enclave_utils/proc_macro/src/lib.rs
+++ b/utils/service_enclave_utils/proc_macro/src/lib.rs
@@ -26,8 +26,8 @@ pub fn teaclave_service(attr: TokenStream, input: TokenStream) -> TokenStream {
{
fn handle_request(
&self,
- request: teaclave_frontend_proto::proto::#request,
- ) -> std::result::Result<teaclave_frontend_proto::proto::#response, teaclave_types::TeaclaveServiceError> {
+ request: #crate_name::proto::#request,
+ ) -> std::result::Result<#crate_name::proto::#response, teaclave_types::TeaclaveServiceError> {
use #crate_name::proto::#trait_name_ident;
use log::trace;
trace!("Dispatching request.");
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org