In-lined.
-----Original Message-----
From: Thiago Macieira [mailto:[email protected]]
Sent: Wednesday, July 27, 2016 12:39 AM
To: ???(Uze Choi)
Cc: i.mushfiq at samsung.com; iotivity-dev at lists.iotivity.org
Subject: Re: [dev] OcResource->getHost() api gives a tricky host address in
Android
Em ter?a-feira, 26 de julho de 2016, ?s 22:29:26 PDT, ???(Uze Choi) escreveu:
> Sorry for late question for this topic.
>
> Antu question is a little bit different from understanding.
> IoTivity has the API to create the remote resource object with once
> discovered resource information as follows.
>
> public static OcResource constructResourceObject(
> String host,
> String uri,
> EnumSet<OcConnectivityType> connectivityTypeSet,
> boolean isObservable,
> List<String> resourceTypeList,
> List<String> interfaceList) throws OcException
>
> This is usually used for accessing resource without discovery step
> which discovered resource yesterday.
Ah, I see. This is a remote resource, to be used without discovery.
It's a flawed API. A resource may be accessed at multiple IP addresses or other
endpoints. If the code can discover or remember the resource without doing a
new discovery, it may know more than one endpoint, so this API should accept a
list of endpoints.
[UZ] Even the resource server provides the multiple endpoint information,
client can take a single endpoint and create the remote resource with it.
This is totally up to client. Of course, I agree it is desirable to
change the API signature receiving multi-end points.
> Regardless re-defining exact API naming, here host param will not
> accept the address with interface name.
That's a bug. It needs to be fixed to accept it.
[UZ]
> Furthermore, for the discovered resource, interface detail can be
> stored in the ifindex.
That's part of the flaw I mentioned above, as the interface index can change
depending on the endpoint in question. That is, the resource could be reached
on two different interfaces, with different endpoint addresses.
[UZ] constructResourceObject(String host, String uri, connectivityTypeSet ...)
-->
constructResourceObject(<List> Endpoints { addr[MAX_ADDR_STR_SIZE],
ifindex...} , ...) will resolve your concern.
So, We can exclude interface name from OCDecAddr->addr[].
typedef struct{
OCTransportAdapter adapter; /** adapter type.*/
OCTransportFlags flags; /** transport
modifiers.*/
uint16_t port; /** for IP.*/
char addr[MAX_ADDR_STR_SIZE]; /** address for
all adapters.*/
uint32_t ifindex; /** usually zero for default
interface.*/
} OCDevAddr;
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center