Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

nml.hh File Reference

#include "rcs_defs.hh"
#include <stddef.h>
#include "cms_user.hh"
#include "linklist.hh"

Include dependency graph for nml.hh:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

class  NML

Typedefs

typedef long NMLTYPE
typedef int(* NML_FORMAT_PTR )(NMLTYPE, void RCS_FAR *, CMS RCS_FAR *)

Enumerations

enum  NML_ERROR_TYPE {
  NML_NO_ERROR, NML_BUFFER_NOT_READ, NML_TIMED_OUT, NML_INVALID_CONFIGURATION,
  NML_FORMAT_ERROR, NML_INTERNAL_CMS_ERROR, NML_NO_MASTER_ERROR, NML_INVALID_MESSAGE_ERROR,
  NML_QUEUE_FULL_ERROR
}
enum  NML_CHANNEL_TYPE {
  INVALID_NML_CHANNEL_TYPE = 0, NML_GENERIC_CHANNEL_TYPE, RCS_CMD_CHANNEL_TYPE, RCS_STAT_CHANNEL_TYPE,
  NML_QUERY_CHANNEL_TYPE, NML_ID_CHANNEL_TYPE
}

Functions

int RCS_EXPORT create_NML (NML **, NML_FORMAT_PTR f_ptr, char *buf, char *proc, char *file)
void RCS_EXPORT free_NML (NML *)
void RCS_EXPORT nml_start ()
void RCS_EXPORT nml_cleanup ()
void RCS_EXPORT nml_wipeout_lists ()
void RCS_EXPORT set_default_nml_config_file (const char RCS_FAR *)
const char *RCS_EXPORT get_default_nml_config_file ()
NML *RCS_EXPORT nmlWaitOpen (NML_FORMAT_PTR fPtr, char *buffer, char *name, char *file, double sleepTime)
void nmlSetHostAlias (const char *hostName, const char *hostAlias)
void nmlClearHostAliases ()
void nmlAllowNormalConnection ()
void nmlForceRemoteConnection ()
void nmlForceLocalConnection ()

Variables

RCS_EXPORT NMLmsg
char NML_ERROR_TYPE_STRINGS [8][80]
RCS_LINKED_LIST RCS_FAR * NML_Main_Channel_List
int verbose_nml_error_messages
int nml_print_hostname_on_error
int nml_reset_errors_printed


Typedef Documentation

typedef long NMLTYPE
 

Definition at line 40 of file nml.hh.

typedef int(* NML_FORMAT_PTR)(NMLTYPE, void RCS_FAR *, CMS RCS_FAR *)
 

Definition at line 48 of file nml.hh.


Enumeration Type Documentation

enum NML_ERROR_TYPE
 

Enumeration values:
NML_NO_ERROR 
NML_BUFFER_NOT_READ 
NML_TIMED_OUT 
NML_INVALID_CONFIGURATION 
NML_FORMAT_ERROR 
NML_INTERNAL_CMS_ERROR 
NML_NO_MASTER_ERROR 
NML_INVALID_MESSAGE_ERROR 
NML_QUEUE_FULL_ERROR 

Definition at line 51 of file nml.hh.

enum NML_CHANNEL_TYPE
 

Enumeration values:
INVALID_NML_CHANNEL_TYPE 
NML_GENERIC_CHANNEL_TYPE 
RCS_CMD_CHANNEL_TYPE 
RCS_STAT_CHANNEL_TYPE 
NML_QUERY_CHANNEL_TYPE 
NML_ID_CHANNEL_TYPE 

Definition at line 65 of file nml.hh.


Function Documentation

int RCS_EXPORT create_NML NML **    nml,
NML_FORMAT_PTR    f_ptr,
char *    buf,
char *    proc,
char *    file
 

Definition at line 263 of file nml.cc.

00265 {
00266   *nml = new NML (f_ptr, buf, proc, file);
00267   if (NULL == nml)
00268     {
00269       return -1;
00270     }
00271   if (!(*nml)->valid ())
00272     {
00273       return -1;
00274     }
00275   if (NULL != (*nml)->cms)
00276     {
00277       (*nml)->cms->sizeof_message_header = (*nml)->sizeof_message_header;
00278       char *forced_type_eq =
00279         strstr ((*nml)->cms->buflineupper, "FORCE_TYPE=");
00280       if (forced_type_eq != NULL)
00281         {
00282 #ifndef UNDER_CE
00283           long temp = strtol (forced_type_eq + 11, NULL, 0);
00284 #else
00285           long temp = atol (forced_type_eq + 11);
00286 #endif
00287           if (temp > 0)
00288             {
00289 
00290               (*nml)->forced_type = temp;
00291             }
00292         }
00293     }
00294   return 0;
00295 }

void RCS_EXPORT free_NML NML   nml
 

Definition at line 298 of file nml.cc.

00299 {
00300   if (NULL != nml)
00301     {
00302       delete nml;
00303     }
00304 }

void RCS_EXPORT nml_start  
 

Definition at line 2689 of file nml.cc.

02690 {
02691 
02692 #ifndef __MSDOS__
02693   spawn_nml_servers ();
02694 #endif /* __MSDOS__ */
02695 }

void RCS_EXPORT nml_cleanup  
 

Definition at line 2698 of file nml.cc.

02699 {
02700   NML *nml;
02701 #if !defined(__MSDOS__) || defined(WIN32)
02702   nml_server_cleanup ();
02703 #endif /* __MSDOS__ */
02704 
02705 #ifdef VXWORKS
02706   int current_pid;
02707   current_pid = taskIdSelf ();
02708 #endif
02709 
02710 #ifdef _Windows
02711   // HANDLE replaced with void RCS_FAR *
02712   void RCS_FAR *current_task_handle;
02713 #ifdef __WIN32__
02714   current_task_handle = GetCurrentThread ();
02715 #else
02716   current_task_handle = GetCurrentTask ();
02717 #endif
02718 #endif
02719 
02720   if (NULL != NML_Main_Channel_List)
02721     {
02722       rcs_print_debug (PRINT_NML_DESTRUCTORS,
02723                        "Deleting %d channels from the NML_Main_Channel_List.\n",
02724                        NML_Main_Channel_List->list_size);
02725       nml = (NML *) NML_Main_Channel_List->get_head ();
02726       while (NULL != nml)
02727         {
02728 #ifdef VXWORKS
02729           if (current_pid != nml->pid)
02730             {
02731               nml = (NML *) NML_Main_Channel_List->get_next ();
02732               continue;
02733             }
02734 #endif
02735 #ifdef _Windows
02736           if (current_task_handle != nml->task_handle)
02737             {
02738               nml = (NML *) NML_Main_Channel_List->get_next ();
02739               continue;
02740             }
02741 #endif
02742           if (nml->cms != NULL)
02743             {
02744               rcs_print_debug (PRINT_NML_DESTRUCTORS,
02745                                "Deleting %s NML channel from NML_Main_Channel_List.\n",
02746                                nml->cms->BufferName);
02747             }
02748           nml->delete_channel ();
02749 
02750           rcs_print_debug (PRINT_NML_DESTRUCTORS,
02751                            "NML channel deleted from NML_Main_Channel_List\n");
02752           if (NULL == NML_Main_Channel_List)
02753             {
02754               return;
02755             }
02756           NML_Main_Channel_List->delete_current_node ();
02757           nml = (NML *) NML_Main_Channel_List->get_next ();
02758         }
02759       if (NULL != NML_Main_Channel_List)
02760         {
02761 #if defined(VXWORKS) || defined(_Windows)
02762           if (0 == NML_Main_Channel_List->list_size)
02763             {
02764 #endif
02765               delete NML_Main_Channel_List;
02766               NML_Main_Channel_List = (RCS_LINKED_LIST *) NULL;
02767 #if defined(VXWORKS) || defined(_Windows)
02768             }
02769 #endif
02770         }
02771     }
02772 #ifndef WINDOWS
02773   if (NULL != Dynamically_Allocated_NML_Objects)
02774     {
02775       nml = (NML *) Dynamically_Allocated_NML_Objects->get_head ();
02776       while (NULL != nml)
02777         {
02778 #ifdef VXWORKS
02779           if (current_pid != nml->pid)
02780             {
02781               nml = (NML *) Dynamically_Allocated_NML_Objects->get_next ();
02782               continue;
02783             }
02784 #endif
02785 #ifdef _Windows
02786           if (current_task_handle != nml->task_handle)
02787             {
02788               nml = (NML *) Dynamically_Allocated_NML_Objects->get_next ();
02789               continue;
02790             }
02791 #endif
02792           if (nml->cms != NULL)
02793             {
02794               rcs_print_debug (PRINT_NML_DESTRUCTORS,
02795                                "Deleting %s NML channel from Dynamically_Allocated_NML_Objects.\n",
02796                                nml->cms->BufferName);
02797             }
02798           delete nml;
02799 
02800           rcs_print_debug (PRINT_NML_DESTRUCTORS,
02801                            "NML channel deleted from Dynamically_Allocated_NML_Objects\n");
02802           if (NULL == Dynamically_Allocated_NML_Objects)
02803             {
02804               return;
02805             }
02806           Dynamically_Allocated_NML_Objects->delete_current_node ();
02807           nml = (NML *) Dynamically_Allocated_NML_Objects->get_next ();
02808         }
02809       if (NULL != Dynamically_Allocated_NML_Objects)
02810         {
02811 #if defined(VXWORKS) || defined(_Windows)
02812           if (0 == Dynamically_Allocated_NML_Objects->list_size)
02813             {
02814 #endif
02815               delete Dynamically_Allocated_NML_Objects;
02816               Dynamically_Allocated_NML_Objects = (RCS_LINKED_LIST *) NULL;
02817 #if defined(VXWORKS) || defined(_Windows)
02818             }
02819 #endif
02820         }
02821     }
02822 #endif
02823   nmlClearHostAliases ();
02824 }

void RCS_EXPORT nml_wipeout_lists  
 

Definition at line 2827 of file nml.cc.

02828 {
02829   if (NULL != NML_Main_Channel_List)
02830     {
02831       delete NML_Main_Channel_List;
02832       NML_Main_Channel_List = (RCS_LINKED_LIST *) NULL;
02833     }
02834   if (NULL != Dynamically_Allocated_NML_Objects)
02835     {
02836       delete Dynamically_Allocated_NML_Objects;
02837       Dynamically_Allocated_NML_Objects = (RCS_LINKED_LIST *) NULL;
02838     }
02839 #ifndef __MSDOS__
02840   if (NULL != NML_Default_Super_Server)
02841     {
02842       delete NML_Default_Super_Server;
02843       NML_Default_Super_Server = (NML_SUPER_SERVER *) NULL;
02844     }
02845 #endif
02846 }

void RCS_EXPORT set_default_nml_config_file const char RCS_FAR *    cfg_file
 

Definition at line 98 of file nml.cc.

Referenced by NML_Main_Channel_List().

00099 {
00100   if (cfg_file == NULL)
00101     {
00102       default_nml_config_file = NULL;
00103     }
00104   default_nml_config_file = (char *) DEBUG_MALLOC (strlen (cfg_file) + 1);
00105   strcpy (default_nml_config_file, cfg_file);
00106 }

const char* RCS_EXPORT get_default_nml_config_file  
 

Definition at line 109 of file nml.cc.

00110 {
00111   return default_nml_config_file;
00112 }

NML* RCS_EXPORT nmlWaitOpen NML_FORMAT_PTR    fPtr,
char *    buffer,
char *    name,
char *    file,
double    sleepTime
 

Definition at line 2880 of file nml.cc.

Referenced by NML_Main_Channel_List().

02882 {
02883   NML *nmlChannel = 0;
02884 
02885   RCS_PRINT_DESTINATION_TYPE olddest = get_rcs_print_destination ();
02886   set_rcs_print_destination (RCS_PRINT_TO_NULL);
02887   nmlChannel = new NML (fPtr, buffer, name, file);
02888   while (!nmlChannel->reset ())
02889     {
02890       esleep (sleepTime);
02891     }
02892   set_rcs_print_destination (olddest);
02893   return (nmlChannel);
02894 }

void nmlSetHostAlias const char *    hostName,
const char *    hostAlias
 

Definition at line 3067 of file nml.cc.

Referenced by NML_Main_Channel_List().

03068 {
03069   if (NULL == cmsHostAliases)
03070     {
03071       cmsHostAliases = new RCS_LINKED_LIST;
03072     }
03073   CMS_HOST_ALIAS_ENTRY entry;
03074   strncpy (entry.host, hostName, 64);
03075   strncpy (entry.alias, hostAlias, 64);
03076   cmsHostAliases->store_at_tail (&entry, sizeof (entry), 1);
03077 }

void nmlClearHostAliases  
 

Definition at line 3080 of file nml.cc.

03081 {
03082   if (NULL != cmsHostAliases)
03083     {
03084       delete cmsHostAliases;
03085       cmsHostAliases = NULL;
03086     }
03087 }

void nmlAllowNormalConnection  
 

Definition at line 3090 of file nml.cc.

03091 {
03092   cms_connection_mode = CMS_NORMAL_CONNECTION_MODE;
03093 }

void nmlForceRemoteConnection  
 

Definition at line 3096 of file nml.cc.

03097 {
03098   cms_connection_mode = CMS_FORCE_REMOTE_CONNECTION_MODE;
03099 }

void nmlForceLocalConnection  
 

Definition at line 3102 of file nml.cc.

03103 {
03104   cms_connection_mode = CMS_FORCE_LOCAL_CONNECTION_MODE;
03105 }


Variable Documentation

class RCS_EXPORT NMLmsg
 

Definition at line 43 of file nml.hh.

char NML_ERROR_TYPE_STRINGS[8][80]
 

Definition at line 76 of file nml.hh.

RCS_LINKED_LIST RCS_FAR* NML_Main_Channel_List
 

Definition at line 213 of file nml.hh.

int verbose_nml_error_messages
 

Definition at line 233 of file nml.hh.

int nml_print_hostname_on_error
 

Definition at line 234 of file nml.hh.

int nml_reset_errors_printed
 

Definition at line 235 of file nml.hh.


Generated on Sun Dec 2 15:57:15 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001