Bug 479340 - Propagation of Target properties into tcf-server
Summary: Propagation of Target properties into tcf-server
Status: RESOLVED FIXED
Alias: None
Product: TCF
Classification: Tools
Component: Agent (show other bugs)
Version: 1.4   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.4   Edit
Assignee: Project Inbox CLA
QA Contact: Eugene Tarassov CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-08 09:46 EDT by xavier pouyollon CLA
Modified: 2016-03-18 08:21 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description xavier pouyollon CLA 2015-10-08 09:46:19 EDT
Hi Eugene,

In our value-add (tcf-server), we'd like to retrieve some  target context
properties like the vxWorks taskId.

On target(agent) side, we could have the taskId stored in the context's
extra properties.
My understanding is that the extra properties are stored in
the Vworks's dedicated ContextExtension.

In runctrl.c, I see a ENABLE_ContextExtraProperties that writes a list
of properties for RunControl getContext command.

My understanding is that the tcf-server reconstruct a list of
Context objects by sending some RunControl getChildren / getContext
in context-proxy.c

However, I don't see any processing of ENABLE_ContextExtraProperties so
the extra-properties aren't stored in the host representation of Context
in tcf-server.

Is that on purpose or is something missing ?
Can we safely add the reading of the extra properties
in context-proxy.c:read_run_control_context_property ?
The question is: Where to store these extra-properties and how to access them ?

I'm still a bit unclear on ContextCache versus Context.
The idea would be in context-proxy.c to retrieve the extra_properties
given by runControl getContext, store them in the ContextCache.
However, I have one issue in add_context_cache, how could I transfer
this ContextCache extra-properties back into the ctx's extension ?
It seems we need a HOOK in add_context_cache just before the
send_context_created_event(c->ctx) ? 

The HOOK would transfer the extra-properties stored in ContextCache back to the ContextExtension (here I mean our ContextExtension zone, not the one of context-proxy.c. This would require us to create in the tcf-server a dedicated
ContextExtension for properties).

Well, I'm not sure to be very clear but how I can implement on
tcf-server the context_get_extra_properties if I can't access the
ContextCache ? That's why I propose the HOOK so we could transfer from
the ContextCache into our ExtensionContext that would store the extra-properties...

In other words, storing the extra-properties in the ContextCache and
transfer them into a specific Context Extension for properties seems
quite a lot of hassle.

If the struct Context had an entry for the properties, it would be
way easier...

Is our understanding correct ? Any other suggestions ?

In case you're wondering : We need that because our Expression service
is not on target but in tcf-server and for TLS support we need to do some reading in the vxWorks TCB that we identify using the vxWorks taskId.

Thanks !
Comment 1 Eugene Tarassov CLA 2015-10-09 02:49:59 EDT
context_get_extra_properties() not supported by context proxy because nobody needed it until now. I added code to support.

Fixed.
Thanks!
Comment 2 xavier pouyollon CLA 2015-10-09 05:10:16 EDT
Hi Eugene,

Great ! Thanks !
Comment 3 Frederic Lievens CLA 2015-10-13 09:00:51 EDT
Hi Eugene,

We now have the vxworks taskId properly "propagated" to the value-add via the extra properties. Thanks.
I had to modify the free_context_extra_props routine for the value-add / tcf-server, as it crashed on a double loc_free.
See below. Do you agree ?
Regards,


static void free_context_extra_props(ContextCache * c) {
#if ENABLE_ContextExtraProperties
    unsigned i;
    /* fix */
    if ((c->props_names == NULL) &&  (c->props_values == NULL)) {
        return;
    }
    /* end fix */
    for (i = 0; i < c->props_cnt; i++) {
        loc_free(c->props_names[i]);
        loc_free(c->props_values[i]);
    }
    loc_free(c->props_names);
    loc_free(c->props_values);
#endif
}
Comment 4 Eugene Tarassov CLA 2015-10-13 12:53:32 EDT
The error is caused by missing "props_cnt=0" in read_context_changed_item().
Fixed.
Thanks!