[Vortex] present user profiles only after securing connection

Francis Brosnan Blazquez francis at aspl.es
Sun Mar 26 11:19:20 CEST 2006

El sáb, 25-03-2006 a las 18:06 -0500, Philip Kovacs escribió:
> Francis,

Hi Phil!

> Besides taking advantage of the one-to-many response
> exchange type of BEEP, you also eliminate the need to run a separate 
> profile on the
> client-side.

I still think two separated profiles will be required, as you proposed.
This will allow you to implement the different logic required to process
replies received, for each profile.

While creating channels [1] you'll have to set a frame received handler
[2]. This handler will be fired once a reply (or a message) is received.

According to the design, only RPY messages should be received on the
frame received handler for the catalog profile and a series of ANS/NUL
messages for the stream profile.

> The data stream definition/proposal will typically have, say, 100+ 
> different data points,
> with configuration information from the catalog.  


> Once the proposal is 
> accepted by the
> server, the negotiation is essentially done.  Then the server's role
> is 
> to periodically take
> the samples, with no additional interaction from the client, and 
> transmit them.  So it's:
> (server) forever:
> {
>    take a hundred different samples
>    format them
>    transmit them
>    (sleep interval)
> }


> Perhaps the way to approach this, as you say, is indeed to have the 
> client create the
> data channel and then, on that data channel, the client sends a
> single 
> msg, such as:
>  "BEGIN STREAM"   Then the server starts pumping ANS chunks back, over
> and
> over, until the a request is sent on the control channel to stop.  

This is the idea. And, the way to stop the stream transmission, will
also do.

> Is it reasonable to run a single MSG->(ANS)+ exchange that might 
> continue indefinitely?
> MSG="start stream"
> ANS+="chunk of n samples"

Sure, and, as you proposed, once it is required to stop the
transmission, a message is sent over the control channel to stop. 

This will cause the above "server foreach" to issue a final NUL message
[3], making your client to have a clear beacon to know when the stream
transmission have definitely stopped. 

This won't be so easy for the MSG/RPY: this is because you never know if
there are more messages to come (every message received is independent
from each other).

> I am assuming of course that I can use callbacks on the client when
> the 
> ANS frames
> arrive.

Sure. The way messages are received (not matter if they are
MSG/RPY/ERR/ANS/NUL) is to fire the same frame received handler [2]
configured for the channel. That is, there is no difference from
handling ANS/NUL or RPY. 

Then, inside this handler, it is required to implement a switch/if-else
to manage the frame received.

For your case, you could even have only one frame received, for your
client application, as follow:

void frame_received (VortexChannel *channel, 
                     VortexConnection *connection, 
                     VortexFrame *frame, 
                     gpointer user_data)
  switch (vortex_frame_get_type (frame)) {
    /* ERROR: client should not receive MSG frames */

    /* uhmmn...it seems a RPY for a catalog request has
       been received. Process the catalog information */
    process_catalog (frame);

    /* it seems a sample has been received due to a 
       stream request */
    process_stream_sample (frame);

    /* an streaming operation is being stopped, signal
       user application this event. */
    process_stream_stoped (frame);

    /* ERROR: client should not receive MSG frames */
  /* do to not unref the frame received on this function. If
     a permanent copy is required, the frame content must be copied
     or a frame copy must be done by using: vortex_frame_copy. */

This is because we are based on the fact that only RPY are received in
response to catalog queries and ANS/NUL are received because streaming
ongoing operations. However, you could also consider to use two
separated frame received handlers.


> Phil




Francis Brosnan Blazquez <francis at aspl.es>
Advanced Software Production Line, S.L.

More information about the Vortex mailing list