ToolTalk User's Guide

Scoping to a File in a Session

The type TT_FILE_IN_SESSION scopes to the specified file in the specified session only. A pattern with this scope set will only match messages that are scoped to both the file and the session. Example 3–5 adds the session and then registers the pattern.


Example 3–5 Adding a Session to the TT_FILE_IN_SESSION-Scoped Pattern

Obtain procid 

tt_open(); 

Create pattern 

Tt_pattern pat = tt_create_pattern(); 

Add scope to pattern 

tt_pattern_scope_add(pat,TT_FILE_IN_SESSION); 

Add file to pattern 

tt_pattern_file_add(pat, file); 

Add session to pattern 

tt_pattern_session_add(pat, tt_default_session()); 

Register pattern 

tt_pattern_register(pat); 


Example 3–6 registers the pattern and then joins a session.


Example 3–6 Joining a Session to Set the Session of a TT_FILE_IN_SESSION-Scoped Pattern

Obtain procid 

tt_open(); 

Create pattern 

Tt_pattern pat = tt_create_pattern(); 

Add scope to pattern 

tt_pattern_scope_add(pat, TT_FILE_IN_SESSION); 

Add file to pattern 

tt_pattern_file_add(pat, file); 

Register pattern 

tt_pattern_register(pat); 

Join session 

tt_session_join(tt_default_session()); 


Example 3–7 sets the scope value for a static pattern.


Example 3–7 Setting the Scope Value for a TT_FILE_IN_SESSION Static Pattern

Obtain procid 

tt_open(); 

Declare Ptype 

Tt_ptype_declare(ptype); 

Join File 

tt_file_join(file); 

Join session 

tt_session_join(tt_default_session());