diff options
author | Erlang/OTP <[email protected]> | 2014-08-07 17:36:24 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2014-08-07 17:36:24 +0200 |
commit | f68b689662dcfba7f6e82bad03938eeb3a48a300 (patch) | |
tree | 7f81f133ec0c8f439083239aec468cc5351f8055 /lib/orber/src/corba.erl | |
parent | 934b6de4d2ab6c31c5217e1ba4779ade9e37cc83 (diff) | |
parent | b1d3fd0943df21a4928ace4101404be97609556d (diff) | |
download | otp-f68b689662dcfba7f6e82bad03938eeb3a48a300.tar.gz otp-f68b689662dcfba7f6e82bad03938eeb3a48a300.tar.bz2 otp-f68b689662dcfba7f6e82bad03938eeb3a48a300.zip |
Merge branch 'lars/orber/dual_ipv6_and_ipv4' into maint-17
* lars/orber/dual_ipv6_and_ipv4:
[orber] Fix bug in testcase
[orber] Fix malformed macros
[orber] Add test suite for ORB with dual ipv4/ipv6 configuration
[orber] Update documentation and fix testcase for IPv4/IPv6
[orber] Update testcases and fixed some minor faults
[orber] Remove unused file corba_request.erl
[orber] Remove a define of ORBVSN when compiling orbers erlang modules
[orber] Add possibilty to configure orber to run in both IPv4 and IPv6
Diffstat (limited to 'lib/orber/src/corba.erl')
-rw-r--r-- | lib/orber/src/corba.erl | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/lib/orber/src/corba.erl b/lib/orber/src/corba.erl index 989e84f581..586a02d540 100644 --- a/lib/orber/src/corba.erl +++ b/lib/orber/src/corba.erl @@ -311,19 +311,18 @@ resolve_initial_references_remote(_ObjectId, [], _Ctx) -> raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}); resolve_initial_references_remote(ObjectId, [RemoteModifier| Rest], Ctx) when is_list(RemoteModifier) -> - case lists:prefix("iiop://", RemoteModifier) of - true -> - [_, Host, Port] = string:tokens(RemoteModifier, ":/"), + case parse_remote_modifier(RemoteModifier) of + {error, _} -> + resolve_initial_references_remote(ObjectId, Rest, Ctx); + {ok, Host, Port} -> IOR = iop_ior:create_external(orber:giop_version(), "", - Host, list_to_integer(Port), "INIT"), + Host, list_to_integer(Port), "INIT"), %% We know it's an external referens. Hence, no need to check. {_, Key} = iop_ior:get_key(IOR), orber_iiop:request(Key, 'get', [ObjectId], {{'tk_objref', 12, "object"}, [{'tk_string', 0}], - []}, 'true', infinity, IOR, Ctx); - false -> - resolve_initial_references_remote(ObjectId, Rest, Ctx) + []}, 'true', infinity, IOR, Ctx) end. list_initial_services_remote(Address) -> @@ -332,24 +331,44 @@ list_initial_services_remote(Address) -> list_initial_services_remote([], _Ctx) -> raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}); list_initial_services_remote([RemoteModifier| Rest], Ctx) when is_list(RemoteModifier) -> - case lists:prefix("iiop://", RemoteModifier) of - true -> - [_, Host, Port] = string:tokens(RemoteModifier, ":/"), + case parse_remote_modifier(RemoteModifier) of + {error, _} -> + resolve_initial_references_remote(Rest, Ctx); + {ok, Host, Port} -> IOR = iop_ior:create_external(orber:giop_version(), "", Host, list_to_integer(Port), "INIT"), %% We know it's an external referens. Hence, no need to check. {_, Key} = iop_ior:get_key(IOR), orber_iiop:request(Key, 'list', [], {{'tk_sequence', {'tk_string',0},0}, - [], []}, 'true', infinity, IOR, Ctx); - false -> - list_initial_services_remote(Rest, Ctx) + [], []}, 'true', infinity, IOR, Ctx) end; list_initial_services_remote(_, _) -> raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). +parse_remote_modifier("iiop://" ++ Rest) -> + parse_host_version(Rest); +parse_remote_modifier(_RemoteModifier) -> + {error, not_supported}. + +parse_host_version("[" ++ Rest) -> + parse_ipv6(Rest, []); +parse_host_version(Rest) -> + parse_ipv4_or_dnsname(Rest, []). + + +parse_ipv4_or_dnsname([$: |Rest], Acc) -> + {ok, lists:reverse(Acc), Rest}; +parse_ipv4_or_dnsname([C |Rest], Acc) -> + parse_ipv4_or_dnsname(Rest, [C |Acc]). + +parse_ipv6("]:" ++ Rest, Acc) -> + {ok, lists:reverse(Acc), Rest}; +parse_ipv6([C |Rest], Acc) -> + parse_ipv6(Rest, [C |Acc]). + %%----------------------------------------------------------------- %% Objectreference convertions %%----------------------------------------------------------------- |