aboutsummaryrefslogtreecommitdiffstats
path: root/example/fileproto.proto
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@npb.mail.kapsi.fi>2011-08-17 19:03:06 +0000
committerPetteri Aimonen <jpa@npb.mail.kapsi.fi>2011-08-17 19:03:06 +0000
commit7f53c3f7484679c1e38607f59542d43be1387650 (patch)
tree396198a24a1661eb7af87d0364a936d8df98a5ae /example/fileproto.proto
parent2cefaeaf61f38f1566293e53b4708e9ceff2d945 (diff)
Example
git-svn-id: https://svn.kapsi.fi/jpa/nanopb@957 e3a754e5-d11d-0410-8d38-ebb782a927b9
Diffstat (limited to 'example/fileproto.proto')
-rw-r--r--example/fileproto.proto26
1 files changed, 26 insertions, 0 deletions
diff --git a/example/fileproto.proto b/example/fileproto.proto
new file mode 100644
index 00000000..e2786b15
--- /dev/null
+++ b/example/fileproto.proto
@@ -0,0 +1,26 @@
+import "nanopb.proto";
+
+// This defines protocol for a simple server that lists files.
+//
+// If you come from high-level programming background, the hardcoded
+// maximum lengths may disgust you. However, if your microcontroller only
+// has a few kB of ram to begin with, setting reasonable limits for
+// filenames is ok.
+//
+// On the other hand, using the callback interface, it is not necessary
+// to set a limit on the number of files in the response.
+
+message ListFilesRequest {
+ optional string path = 1 [default = "/", (nanopb).max_size = 128];
+}
+
+message FileInfo {
+ required uint64 inode = 1;
+ required string name = 2 [(nanopb).max_size = 128];
+}
+
+message ListFilesResponse {
+ optional bool path_error = 1 [default = false];
+ repeated FileInfo file = 2;
+}
+