/*--------------------------------------------------------------------
 * Name:   mscgen.h
 * Author: ITEX C-Code Generator
 * 
 * Copyright 1991-98 Telelogic AB, All rights reserved.
 * 
 * This Program is owned by Telelogic and is protected by national
 * copyright laws and international copyright treaties. Telelogic
 * grants you the right to use this Program on one computer or in one
 * local computer network at any one time.  Under this License you may
 * only modify the source code for the purpose of adapting it to your
 * environment. You must reproduce and include any copyright and
 * trademark notices on all copies of the source code.  You may not
 * use, copy, merge, modify or transfer the Program except as provided
 * in this License.  Telelogic does not warrant that the Program will
 * meet your requirements or that the operation of the Program will be
 * uninterrupted and error free. You are solely responsible that the
 * selection of the Program and the modification of the source code
 * will achieve your intended results and that the results are
 * actually obtained.
 */

#ifndef MSCGEN_H
#define MSCGEN_H

/*--------------------------------------------------------------------
 *
 * About this file: 
 * 
 * This file defines an interface internal to the ITEX c code generator
 * runtime environment. It is not supposed to be accessed by user-defined
 * code.
 *
 * There are more comments in the accompanying mscgen.c file,
 * and also in the Telelogic Tau reference manual. This file is
 * subject to change between releases and user changes may not be
 * supported. 
 */

/*-------------------------------------------------------------------- 
 *  Definition Name: MscLogMode
 *  Description:     Identifies the msc generation modes.
 */

typedef enum { 
  MscNologMode,			/* No MSC logging at all */
  MscComposedMode,		/* Composed tester - only external events */
  MscDecomposedMode		/* Almost all internal events and PTCs */
} MscLogMode;

/*-------------------------------------------------------------------- 
 *  Definition Name: MscMessageDirection
 *  Description:     Used to determine the direction of events relative
 *		     to the ETS.
 */

typedef enum {
  MscSendMessage,		/* Message from ETS to IUT */
  MscReceiveMessage,		/* Message from IUT to ETS */
  MscInternalMessage		/* Message from PTC to PTC */
} MscMessageDirection;

/*-------------------------------------------------------------------- 
 *  Function prototypes for MSC generation management.
 */

extern void MscInit( void );	/* Call only once from GciInit  */
extern void MscExit( void );	/* Call only once from GciExit  */

extern void MscSetLogMode( MscLogMode logmode );
extern void MscSetSystemName( const char * iut );
extern void MscSetFilePrefix( const char * prefix );

/*-------------------------------------------------------------------- 
 *  Function prototypes TTCN operation logging. They internally do the
 *  filtering determined by the MSC generation mode.
 */

extern void MscStartTestCase( const char * ptc, const char * name );
extern void MscStopTestCase( const char * ptc );
extern void MscOut( MscMessageDirection direction, 
		    const char * from, const char * to, 
		    GciValue * value, const char * comment );
extern void MscIn( MscMessageDirection direction,
		   const char * from, const char * to, 
		   const char * comment );
extern void MscImplicitSend( const char * ptc, GciValue * value );
extern void MscStartTimer( const char* ptc, const char * timer, long dur );
extern void MscCancelTimer( const char* ptc, const char * timer );
extern void MscTimeoutTimer( const char* ptc, const char * timer );
extern void MscCreateComponent( const char* parent, const char *child );
extern void MscDoneComponent( const char* ptc );
extern void MscPreliminaryVerdict( const char* ptc, const char * verdict );
extern void MscFinalVerdict( const char* ptc, const char * verdict );

/*--------------------------------------------------------------------
 * Utility function that may be useful for other code as well, for a
 * decoder may use this to log what value was decoded, though that is
 * also done by the MSCs ... if enabled. Note that there are some
 * limitations to the supported types.  
 */

extern void MscEncodeValue( GciValue * value, char * pos, int left );

#endif /* MSCGEN_H */

