11 #include <sys/types.h> 13 #include <netinet/in.h> 18 #include <sys/timeb.h> 25 sprintf( proc_name,
"%d", getpid() );
27 sprintf( proc_name,
"%d", taskIdSelf() );
41 extern void init_sock();
48 if( (p = getenv(
"DIM_HOST_NODE")) != NULL )
50 strcpy( node_name, p );
61 if(!strchr(node_name,
'.'))
63 if ((host = gethostbyname(node_name)) != (
struct hostent *)0)
65 strcpy(node_name,host->h_name);
66 if(!strchr(node_name,
'.'))
70 if(host->h_aliases[0])
72 for(i = 0; host->h_aliases[
i]; i++)
74 p = host->h_aliases[
i];
101 struct hostent *host;
111 if ((host = (
struct hostent *)gethostbyname(node_name)) == (
struct hostent *)0)
119 ptr = (
char *)host->h_addr;
120 node_addr[0] = *ptr++;
121 node_addr[1] = *ptr++;
122 node_addr[2] = *ptr++;
123 node_addr[3] = *ptr++;
139 t =
time((time_t *)0);
152 str[(int)strlen(str)-1] =
'\0';
153 printf(
"PID %d - ",getpid());
154 printf(
"%s - ",str );
162 struct timeb timebuf;
170 millies = timebuf.millitm;
173 gettimeofday(&tv, tz);
174 millies = (int)tv.tv_usec / 1000;
177 printf(
"milliseconds: %d ", millies);
185 case 0: printf(
"(INFO) ");
187 case 1: printf(
"(WARNING) ");
189 case 2: printf(
"(ERROR) ");
191 case 3: printf(
"(FATAL) ");
200 printf(
"\n\nDNA library panic: %s\n\n", s );
208 if( (p = getenv(
"DIM_DNS_NODE")) == NULL )
211 strcpy( node_name, p );
220 if( (p = getenv(
"DIM_DNS_PORT")) == NULL )
232 if( (p = getenv(env_var)) == NULL )
235 tot = (int)strlen(p)+1;
241 strncpy(value, p, (
size_t)sz);
242 if((sz == len) && (len > 0))
256 if( (p = getenv(
"DIM_DNS_ACCEPTED_DOMAINS")) == NULL )
265 strcpy( domains, p );
268 strcat( domains,
",");
279 if( (p = getenv(
"DIM_DNS_ACCEPTED_NODES")) == NULL )
291 if( (p = getenv(
"DIM_KEEPALIVE_TMOUT")) == NULL )
302 if( (p = getenv(
"DIM_WRITE_TMOUT")) == NULL )
#define my_ctime(t, str, size)
int dim_get_env_var(char *env_var, char *value, int len)
int get_node_addr(char *node_addr)
int get_dns_node_name(char *node_name)
int get_dns_accepted_nodes(char *nodes)
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
int get_dns_port_number()
void dim_print_date_time()
void dim_print_msg(char *msg, int severity)
int get_proc_name(char *proc_name)
int get_node_name(char *node_name)
int get_keepalive_tmout()
sprintf(name1,"NewService%d", i)
int get_dns_accepted_domains(char *domains)
void dim_print_date_time_millis()