{
diff --git a/protos/agent.proto b/sdk/protos/track_and_trace_agent.proto
similarity index 100%
rename from protos/agent.proto
rename to sdk/protos/track_and_trace_agent.proto
diff --git a/protos/payload.proto b/sdk/protos/track_and_trace_payload.proto
similarity index 97%
rename from protos/payload.proto
rename to sdk/protos/track_and_trace_payload.proto
index 196af36143..2187221e92 100644
--- a/protos/payload.proto
+++ b/sdk/protos/track_and_trace_payload.proto
@@ -15,8 +15,8 @@
syntax = "proto3";
-import "property.proto";
-import "proposal.proto";
+import "track_and_trace_property.proto";
+import "track_and_trace_proposal.proto";
message SCPayload {
diff --git a/protos/property.proto b/sdk/protos/track_and_trace_property.proto
similarity index 100%
rename from protos/property.proto
rename to sdk/protos/track_and_trace_property.proto
diff --git a/protos/proposal.proto b/sdk/protos/track_and_trace_proposal.proto
similarity index 100%
rename from protos/proposal.proto
rename to sdk/protos/track_and_trace_proposal.proto
diff --git a/protos/record.proto b/sdk/protos/track_and_trace_record.proto
similarity index 97%
rename from protos/record.proto
rename to sdk/protos/track_and_trace_record.proto
index fabea61c40..c36eab0448 100644
--- a/protos/record.proto
+++ b/sdk/protos/track_and_trace_record.proto
@@ -15,7 +15,7 @@
syntax = "proto3";
-import "property.proto";
+import "track_and_trace_property.proto";
message Record {
diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs
new file mode 100644
index 0000000000..1a762592b4
--- /dev/null
+++ b/sdk/src/lib.rs
@@ -0,0 +1,15 @@
+// Copyright 2019 Cargill Incorporated
+//
+// Licensed 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.
+
+pub mod protos;
diff --git a/sdk/src/protos.rs b/sdk/src/protos.rs
new file mode 100644
index 0000000000..31a00dcad1
--- /dev/null
+++ b/sdk/src/protos.rs
@@ -0,0 +1,77 @@
+// Copyright 2018 Bitwise IO, Inc.
+//
+// Licensed 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.
+
+use std::error::Error as StdError;
+
+#[derive(Debug)]
+pub enum ProtoConversionError {
+ SerializationError(String),
+ InvalidTypeError(String),
+}
+
+impl StdError for ProtoConversionError {
+ fn description(&self) -> &str {
+ match *self {
+ ProtoConversionError::SerializationError(ref msg) => msg,
+ ProtoConversionError::InvalidTypeError(ref msg) => msg,
+ }
+ }
+
+ fn cause(&self) -> Option<&StdError> {
+ match *self {
+ ProtoConversionError::SerializationError(_) => None,
+ ProtoConversionError::InvalidTypeError(_) => None,
+ }
+ }
+}
+
+impl std::fmt::Display for ProtoConversionError {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ match *self {
+ ProtoConversionError::SerializationError(ref s) => {
+ write!(f, "SerializationError: {}", s)
+ }
+ ProtoConversionError::InvalidTypeError(ref s) => write!(f, "InvalidTypeError: {}", s),
+ }
+ }
+}
+
+pub trait FromProto: Sized {
+ fn from_proto(other: P) -> Result;
+}
+
+pub trait FromNative: Sized {
+ fn from_native(other: N) -> Result;
+}
+
+pub trait IntoNative: Sized
+where
+ T: FromProto,
+{
+ fn into_native(self) -> Result {
+ FromProto::from_proto(self)
+ }
+}
+
+pub trait IntoProto: Sized
+where
+ T: FromNative,
+{
+ fn into_proto(self) -> Result {
+ FromNative::from_native(self)
+ }
+}
+
+// Includes the autogenerated protobuf messages
+include!(concat!(env!("OUT_DIR"), "/protos/mod.rs"));