Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

main.C File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <pwd.h>
#include "InfoStream.h"
#include "memusage.h"
#include "main.decl.h"
#include "main.h"
#include "main.def.h"

Go to the source code of this file.

Classes

class  main

Defines

#define TBSOFT_TRACK_HOST   "130.126.120.106"
#define TBSOFT_TRACK_PORT   3141
#define TBSOFT_TRACK_MAXLEN   1024

Functions

int send_dgram (const char *host_addr, int port, const char *buf, int buflen)
int tbsoft_sendusage (const char *program, const char *versionnum, const char *platform, const char *numcpus, const char *miscinfo)

Variables

const char * namd_build_date
const char * namd_build_user
const char * namd_build_machine


Define Documentation

#define TBSOFT_TRACK_HOST   "130.126.120.106"
 

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 16 of file main.C.

Referenced by tbsoft_sendusage().

#define TBSOFT_TRACK_MAXLEN   1024
 

Definition at line 18 of file main.C.

#define TBSOFT_TRACK_PORT   3141
 

Definition at line 17 of file main.C.

Referenced by tbsoft_sendusage().


Function Documentation

int send_dgram const char *  host_addr,
int  port,
const char *  buf,
int  buflen
 

Definition at line 41 of file main.C.

Referenced by tbsoft_sendusage().

00041                                                                              {
00042   struct sockaddr_in addr;
00043   int sockfd;
00044 
00045 #ifndef NOHOSTNAME
00046   if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
00047     return -1;
00048   } 
00049 
00050   memset(&addr, 0, sizeof(addr));
00051   addr.sin_family = AF_INET;
00052   addr.sin_port = htons(port);
00053   addr.sin_addr.s_addr = inet_addr(host_addr);
00054 
00055   sendto(sockfd, buf, buflen, 0, (struct sockaddr *)&addr, sizeof(addr));
00056 
00057   close(sockfd);
00058 #endif
00059 
00060   return 0;
00061 }                     

int tbsoft_sendusage const char *  program,
const char *  versionnum,
const char *  platform,
const char *  numcpus,
const char *  miscinfo
 

Definition at line 64 of file main.C.

References iINFO(), iout, send_dgram(), TBSOFT_TRACK_HOST, and TBSOFT_TRACK_PORT.

Referenced by main::main().

00068                                            {
00069 
00070 #ifndef NOHOSTNAME
00071 #ifdef TRACK_USERS
00072   iout << iINFO <<
00073      "Sending usage information to NAMD developers via UDP.  Sent data is:\n"
00074      << endi;
00075 #endif
00076 
00077   char sendbuf[TBSOFT_TRACK_MAXLEN];
00078   char host[128];
00079   struct passwd *pw;
00080   char user[128];
00081 
00082   memset(sendbuf, 0, sizeof(sendbuf));
00083 
00084   gethostname(host, 128);  host[127] = 0;
00085   pw = getpwuid(getuid());
00086   if ( pw && pw->pw_name ) {
00087     strncpy(user, pw->pw_name, 127);  user[127] = 0;
00088   } else {
00089     sprintf(user,"%d",getuid());
00090   }
00091 
00092   sprintf(sendbuf, "1 %s  %s  %s  %s  %s  %s  %s", 
00093     program, versionnum, platform, numcpus, miscinfo, host, user);
00094   iout << iINFO << sendbuf << "\n" << endi;
00095 #ifdef TRACK_USERS
00096   send_dgram(TBSOFT_TRACK_HOST, TBSOFT_TRACK_PORT, sendbuf, strlen(sendbuf));
00097 #endif
00098 
00099 #endif
00100   return 0;
00101 }


Variable Documentation

const char* namd_build_date
 

Referenced by main::main().

const char* namd_build_machine
 

Referenced by main::main().

const char* namd_build_user
 

Referenced by main::main().


Generated on Sat Sep 6 04:07:43 2008 for NAMD by  doxygen 1.3.9.1