librpc/rpc: add ncacn_option_by_name()
authorStefan Metzmacher <metze@samba.org>
Thu, 23 Jan 2014 13:26:04 +0000 (14:26 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 13 Feb 2014 10:54:14 +0000 (11:54 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
librpc/rpc/binding.c

index aa1f31bbc6abba4bf12c81b715cf4d7d45669b62..15c1bca3f285cc16d525f855d57d0e2f234d1740 100644 (file)
@@ -74,7 +74,7 @@ static const struct {
        },
 };
 
-static const struct {
+static const struct ncacn_option {
        const char *name;
        uint32_t flag;
 } ncacn_options[] = {
@@ -92,6 +92,24 @@ static const struct {
        {"ndr64", DCERPC_NDR64},
 };
 
+static const struct ncacn_option *ncacn_option_by_name(const char *name)
+{
+       size_t i;
+
+       for (i=0; i<ARRAY_SIZE(ncacn_options); i++) {
+               int ret;
+
+               ret = strcasecmp(ncacn_options[i].name, name);
+               if (ret != 0) {
+                       continue;
+               }
+
+               return &ncacn_options[i];
+       }
+
+       return NULL;
+}
+
 const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
 {
        struct ndr_syntax_id syntax;