diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-01-23 12:03:46 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2014-02-11 16:20:31 +0100 |
commit | 9a084b4ab286d0ca73ce6ebb374e660da0820957 (patch) | |
tree | c32a9f78f6a4c462bd4cd56f1a690eaf04d1a53d /librpc/rpc | |
parent | ded957614bf70560f3ffa6b6021eba37f2e2dbbb (diff) | |
download | samba-9a084b4ab286d0ca73ce6ebb374e660da0820957.tar.gz |
librpc/rpc: add dcerpc_transport_by_name()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'librpc/rpc')
-rw-r--r-- | librpc/rpc/binding.c | 18 | ||||
-rw-r--r-- | librpc/rpc/rpc_common.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c index cd896b0d71a..53309163a40 100644 --- a/librpc/rpc/binding.c +++ b/librpc/rpc/binding.c @@ -7,6 +7,7 @@ Copyright (C) Jelmer Vernooij 2004 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005 Copyright (C) Rafal Szczesniak 2006 + Copyright (C) Stefan Metzmacher 2014 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -675,6 +676,23 @@ _PUBLIC_ const char *derpc_transport_string_by_transport(enum dcerpc_transport_t return NULL; } +_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_name(const char *name) +{ + size_t i; + + if (name == NULL) { + return NCA_UNKNOWN; + } + + for (i=0; i<ARRAY_SIZE(transports);i++) { + if (strcasecmp(name, transports[i].name) == 0) { + return transports[i].transport; + } + } + + return NCA_UNKNOWN; +} + _PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, struct epm_tower *tower, struct dcerpc_binding **b_out) diff --git a/librpc/rpc/rpc_common.h b/librpc/rpc/rpc_common.h index dd47323dd31..6d23cebc2c0 100644 --- a/librpc/rpc/rpc_common.h +++ b/librpc/rpc/rpc_common.h @@ -138,6 +138,7 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b); NTSTATUS dcerpc_floor_get_lhs_data(const struct epm_floor *epm_floor, struct ndr_syntax_id *syntax); const char *derpc_transport_string_by_transport(enum dcerpc_transport_t t); +enum dcerpc_transport_t dcerpc_transport_by_name(const char *name); enum dcerpc_transport_t dcerpc_transport_by_tower(const struct epm_tower *tower); /* The following definitions come from ../librpc/rpc/dcerpc_util.c */ |