diff options
author | csharptest <roger@csharptest.net> | 2011-05-03 13:47:34 -0500 |
---|---|---|
committer | rogerk <devnull@localhost> | 2011-05-03 13:47:34 -0500 |
commit | 68d831e3a48ea3a81b3791a24219bc3406b962b8 (patch) | |
tree | 547c3752df70d5c79f2c9fe122c7610b5c3fcffd /protos | |
parent | 82bb0f1ef9ba8e996aecf143b1bde6c467d27851 (diff) | |
download | protobuf-68d831e3a48ea3a81b3791a24219bc3406b962b8.tar.gz protobuf-68d831e3a48ea3a81b3791a24219bc3406b962b8.tar.bz2 protobuf-68d831e3a48ea3a81b3791a24219bc3406b962b8.zip |
Implementation of service interface generator
Diffstat (limited to 'protos')
-rw-r--r-- | protos/extest/unittest_rpc_interop.proto | 34 | ||||
-rw-r--r-- | protos/google/protobuf/csharp_options.proto | 176 |
2 files changed, 137 insertions, 73 deletions
diff --git a/protos/extest/unittest_rpc_interop.proto b/protos/extest/unittest_rpc_interop.proto new file mode 100644 index 00000000..4c9f3289 --- /dev/null +++ b/protos/extest/unittest_rpc_interop.proto @@ -0,0 +1,34 @@ +// Additional options required for C# generation. File from copyright
+// line onwards is as per original distribution.
+import "google/protobuf/csharp_options.proto";
+option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
+option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestRpcInterop";
+
+option (google.protobuf.csharp_file_options).service_generator_type = IRPCDISPATCH;
+
+option optimize_for = SPEED;
+
+message SearchRequest {
+ repeated string Criteria = 1;
+}
+
+message SearchResponse {
+ message ResultItem {
+ required string url = 1;
+ optional string name = 2;
+ }
+
+ repeated ResultItem results = 1;
+}
+
+message RefineSearchRequest {
+ repeated string Criteria = 1;
+ required SearchResponse previous_results = 2;
+}
+
+service SearchService {
+ option (google.protobuf.csharp_service_options).interface_id = "{A65F0925-FD11-4f94-B166-89AC4F027205}";
+ rpc Search (SearchRequest) returns (SearchResponse) { option (google.protobuf.csharp_method_options).dispatch_id = 5; };
+
+ rpc RefineSearch (RefineSearchRequest) returns (SearchResponse);
+}
diff --git a/protos/google/protobuf/csharp_options.proto b/protos/google/protobuf/csharp_options.proto index 1d2ff2b8..d9fe04e1 100644 --- a/protos/google/protobuf/csharp_options.proto +++ b/protos/google/protobuf/csharp_options.proto @@ -1,73 +1,103 @@ -// Extra options for C# generator - -import "google/protobuf/descriptor.proto"; - -package google.protobuf; - -message CSharpFileOptions { - - // Namespace for generated classes; defaults to the package. - optional string namespace = 1; - - // Name of the "umbrella" class used for metadata about all - // the messages within this file. Default is based on the name - // of the file. - optional string umbrella_classname = 2; - - // Whether classes should be public (true) or internal (false) - optional bool public_classes = 3 [default = true]; - - // Whether to generate a single file for everything within the - // .proto file (false), or one file per message (true). - // This option is not currently honored; please log a feature - // request if you really want it. - optional bool multiple_files = 4; - - // Whether to nest messages within a single umbrella class (true) - // or create the umbrella class as a peer, with messages as - // top-level classes in the namespace (false) - optional bool nest_classes = 5; - - // Generate appropriate support for Code Contracts - // (Ongoing; support should improve over time) - optional bool code_contracts = 6; - - // Create subdirectories for namespaces, e.g. namespace "Foo.Bar" - // would generate files within [output directory]/Foo/Bar - optional bool expand_namespace_directories = 7; - - // Generate attributes indicating non-CLS-compliance - optional bool cls_compliance = 8 [default = true]; - - // The extension that should be appended to the umbrella_classname when creating files. - optional string file_extension = 221 [default = ".cs"]; - - // A nested namespace for the umbrella class. Helpful for name collisions caused by - // umbrella_classname conflicting with an existing type. This will be automatically - // set to 'Proto' if a collision is detected with types being generated. This value - // is ignored when nest_classes == true - optional string umbrella_namespace = 222; - - // The output path for the source file(s) generated - optional string output_directory = 223 [default = "."]; - - // Will ignore the type generations and remove dependencies for the descriptor proto - // files that declare their package to be "google.protobuf" - optional bool ignore_google_protobuf = 224 [default = false]; -} - -extend FileOptions { - optional CSharpFileOptions csharp_file_options = 1000; -} - -extend FieldOptions { - optional CSharpFieldOptions csharp_field_options = 1000; -} - -message CSharpFieldOptions { - // Provides the ability to override the name of the property - // generated for this field. This is applied to all properties - // and methods to do with this field, including HasFoo, FooCount, - // FooList etc. - optional string property_name = 1; -} +// Extra options for C# generator
+
+import "google/protobuf/descriptor.proto";
+
+package google.protobuf;
+
+message CSharpFileOptions {
+
+ // Namespace for generated classes; defaults to the package.
+ optional string namespace = 1;
+
+ // Name of the "umbrella" class used for metadata about all
+ // the messages within this file. Default is based on the name
+ // of the file.
+ optional string umbrella_classname = 2;
+
+ // Whether classes should be public (true) or internal (false)
+ optional bool public_classes = 3 [default = true];
+
+ // Whether to generate a single file for everything within the
+ // .proto file (false), or one file per message (true).
+ // This option is not currently honored; please log a feature
+ // request if you really want it.
+ optional bool multiple_files = 4;
+
+ // Whether to nest messages within a single umbrella class (true)
+ // or create the umbrella class as a peer, with messages as
+ // top-level classes in the namespace (false)
+ optional bool nest_classes = 5;
+
+ // Generate appropriate support for Code Contracts
+ // (Ongoing; support should improve over time)
+ optional bool code_contracts = 6;
+
+ // Create subdirectories for namespaces, e.g. namespace "Foo.Bar"
+ // would generate files within [output directory]/Foo/Bar
+ optional bool expand_namespace_directories = 7;
+
+ // Generate attributes indicating non-CLS-compliance
+ optional bool cls_compliance = 8 [default = true];
+
+ // The extension that should be appended to the umbrella_classname when creating files.
+ optional string file_extension = 221 [default = ".cs"];
+
+ // A nested namespace for the umbrella class. Helpful for name collisions caused by
+ // umbrella_classname conflicting with an existing type. This will be automatically
+ // set to 'Proto' if a collision is detected with types being generated. This value
+ // is ignored when nest_classes == true
+ optional string umbrella_namespace = 222;
+
+ // The output path for the source file(s) generated
+ optional string output_directory = 223 [default = "."];
+
+ // Will ignore the type generations and remove dependencies for the descriptor proto
+ // files that declare their package to be "google.protobuf"
+ optional bool ignore_google_protobuf = 224 [default = false];
+
+ // Controls how services are generated, GENERIC is the deprecated original implementation
+ // INTERFACE generates service interfaces only, RPCINTEROP generates interfaces and
+ // implementations using the included Windows RPC interop libarary.
+ optional CSharpServiceType service_generator_type = 225 [default = GENERIC];
+}
+
+enum CSharpServiceType {
+ // Generates the original Java generic service implementations
+ GENERIC = 1;
+ // Generates an interface for the service and nothing else
+ INTERFACE = 2;
+ // Generates an interface for the service and client/server wrappers for the interface
+ IRPCDISPATCH = 3;
+}
+
+extend FileOptions {
+ optional CSharpFileOptions csharp_file_options = 1000;
+}
+
+extend FieldOptions {
+ optional CSharpFieldOptions csharp_field_options = 1000;
+}
+
+message CSharpFieldOptions {
+ // Provides the ability to override the name of the property
+ // generated for this field. This is applied to all properties
+ // and methods to do with this field, including HasFoo, FooCount,
+ // FooList etc.
+ optional string property_name = 1;
+}
+
+message CSharpServiceOptions {
+ optional string interface_id = 1;
+}
+
+extend ServiceOptions {
+ optional CSharpServiceOptions csharp_service_options = 1000;
+}
+
+message CSharpMethodOptions {
+ optional int32 dispatch_id = 1;
+}
+
+extend MethodOptions {
+ optional CSharpMethodOptions csharp_method_options = 1000;
+}
\ No newline at end of file |