From: Theodore Tso Date: Thu, 17 Apr 1997 15:25:56 +0000 (+0000) Subject: Add MIT's version server include files and libraries X-Git-Tag: krb5-1.1-beta1~1152 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=76e9c5c254f618b90542b3e309ac5e3a0a888786;p=krb5.git Add MIT's version server include files and libraries git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10071 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/mit/windows/include/v.h b/src/mit/windows/include/v.h new file mode 100644 index 000000000..dbe250b91 --- /dev/null +++ b/src/mit/windows/include/v.h @@ -0,0 +1,102 @@ +#include "mitcpyrt.h" +/* v.h -- header for vlib.c */ + +#ifndef _VERSION_INC +#define _VERSION_INC + +/* + * values for op_code field + */ + +enum v_op_code + { + V_CHECK, /* op codes from server to client */ + V_CHECK_AND_LOG, + V_LOG, + V_LOG_PANIC, + V_OK, /* op codes from client to server */ + V_ERROR, + V_BAD_OP_CODE /* make sure this one is last */ + }; + +/* + * Values for status field + */ + + +#define V_REQUIRED 'R' /* new verison is absolutely required!! */ +#define V_RECOMMENDED 'r' /* new version is recommended. */ +#define V_OPTIONAL 'o' /* new version is optional */ +#define V_UP_TO_DATE 'u' +#define V_NEW_DOCUMENTATION 'd' +#define V_MESSAGE 'm' /* arbitrary message */ +#define V_BAD_STATUS '?' /* make sure this one is last */ + +static struct + { + char status; + char *status_name; + } version_status[] = + { + V_REQUIRED, "required", + V_RECOMMENDED, "recommended", + V_OPTIONAL, "optional", + V_UP_TO_DATE, "up_to_date", + V_NEW_DOCUMENTATION, "new_documentation", + V_MESSAGE, "message", + V_BAD_STATUS, "bad_status" + }; + +#define V_MAXDATA 700 + + +/* + * The general strategy here is we have two formats, a parsed format and a network format... + * "v_info" is parsed, and "v_pkt" is for the network. Note that the total size of all the + * strings in "v_info" had better fit into V_MAXDATA or we'll have some trouble assembling + * the packet. In a future protocol version, perhaps we'll actually USE the packet sequencing + * fields we've already declared, and send things in multiple packets.... + */ + +struct v_info + { + char *appl_name; /* Typically, these are pointers into */ + char *appl_vers; /* a struct v_pkt's */ + char *platform; /* data field (and are null-terminated strings) */ + char *status; /* status of this version */ + /* this string should be length 1, eg, V_OPTIONAL */ + char *message; + }; + +struct v_pkt + { + unsigned short protocol_version; + unsigned short packet_number; + unsigned short number_of_packets; + unsigned short op_code; + unsigned long seq; + char data[V_MAXDATA]; /* buffer of null delimited strings */ + }; + +#ifdef TEST +# define VERSION_FILE "/afs/net/project/net_dev/versions/test-version.txt" +# define VERSION_DB_FILE "/afs/net/project/net_dev/versions/test-db" +#else +# define VERSION_FILE "/afs/net/project/net_dev/version_db/version.txt" +# define VERSION_DB_FILE "/afs/net/project/net_dev/version_db/db" +#endif + +#define VERSION_LOG_DIR "/site/versions/" +#define VERSION_ERROR_LOG "bad-requests" +#define VERSION_SERVER_HOST "versions.mit.edu" +#define VERSION_SERVER_PORT 8500 +#define VERSION_CLIENT_PORT (VERSION_SERVER_PORT+1) +#define VERSION_PROTOCOL_VERSION 1 +#define V_BASE_SIZE (sizeof(struct v_pkt)-V_MAXDATA) +#define DLM ':' +#define KEY_SIZE 100 +#define LOG_CLASS LOG_LOCAL4 + +#define V_MACOS "MacOS" +#endif /* _VERSION_INC */ +/* end of file */ diff --git a/src/mit/windows/include/vs.h b/src/mit/windows/include/vs.h new file mode 100644 index 000000000..5204582f6 --- /dev/null +++ b/src/mit/windows/include/vs.h @@ -0,0 +1,181 @@ +#include "mitcpyrt.h" + + + /* + *---------------------------------------------------------------- + * + * $Source$ + * $Revision$ + * $Date$ + * $State$ + * $Author$ Jason Sachs (nosaj) + * $Locker$ + * + * $Log$ + * Revision 1.1 1997/04/17 15:25:52 tytso + * Add MIT's version server include files and libraries. + * + * Revision 1.3 92/08/27 10:44:51 pbh + * alpha 0.2a check in + * rebuilt manually + * + * Revision 0.1 92/08/25 10:00:20 pbh + * alpha 0.1a + */ + + + +/* vs.h -- defines for the Version Server checking routines. */ + +/* jms 6/3/92 */ + +#ifndef VS_HEADER_STUFF +#define VS_HEADER_STUFF + +#include "v.h" +#include + +typedef unsigned char VS_Status; +typedef unsigned long VS_Request; /* For compatibility reasons */ + +#if defined(WINDOWS) || defined(MEWEL) + #ifdef VS_INCWINDOWS + #include + #endif /* should we include windows.h here? */ +#else + #ifndef FAR /* il 7/25/95 */ + #define FAR + /* no need for that here */ + #endif + + #ifndef BOOL /* il 7/25/95 */ + #define BOOL int + #endif + + #ifndef NULL + #define NULL 0 + #endif /* Null */ + +#endif + +/* patch for nt. il 7/24/95 -- adding nt */ +#include "vs_nt.h" + +typedef struct v_req_info VS_ReqInfo, *VS_ReqInfoPtr; +#define VS_NAT_ReqInfoPtr VS_ReqInfo * + +#if defined(MEWEL) || defined(WINDOWS) + #if defined(WIN32) /* il 7/27/95 -- added nt */ + #define RequestAlloc (VS_Request) LocalAlloc + #define RequestLock(request) (VS_ReqInfoPtr) LocalLock((LOCALHANDLE)(request)) + #define RequestFree(request) LocalFree((LOCALHANDLE)(request)) + #define RequestUnlock(request) LocalUnlock((LOCALHANDLE)(request)) + #else + #define RequestAlloc (VS_Request) LocalAlloc + #define RequestLock(request) (VS_ReqInfoPtr) LocalLock((LOCALHANDLE)(LOWORD(request))) + #define RequestFree(request) LocalFree((LOCALHANDLE)(LOWORD(request))) + #define RequestUnlock(request) LocalUnlock((LOCALHANDLE)(LOWORD(request))) + #endif +#else + #define RequestAlloc(flags,size) (VS_Request) malloc(size) + #define RequestLock (char *) + #define RequestFree(request) free((char *) request) + #define RequestUnlock(request) /* nothin' */ +#endif /* jms 08/13/93 */ + +/* status codes */ + +#define V_E_SELECT 255 +#define V_E_TIMEOUT 254 +#define V_E_SELECT_STRANGEFD 253 +#define V_E_RECVFROM 252 +#define V_E_UNKNOWN 251 +#define V_E_BAD_OP_CODE 250 +#define V_E_HOSTNOTFOUND 249 +#define V_E_SOCKET 248 +#define V_E_BIND 247 +#define V_E_SENDTO 246 +#define V_E_DLLNOTFOUND 245 +#define V_E_NOMEMORY 244 +#define V_E_CANCEL 243 + +#define VSR_OK 0 + +/* classifications of errors */ + +#define V_C_NOERROR 0 +#define V_C_TRY_AGAIN 1 +#define V_C_DEFINITE 2 +#define V_C_FAIL 3 + +extern VS_Status _far _cdecl err_classify(VS_Status error); +#if defined(MEWEL) || defined(WINDOWS) +/* jms 2/16/93 */ +extern BOOL _far _cdecl v_complain(VS_Status error, LPSTR inifilename); +#endif + +#define V_TRY_AGAIN(status) (err_classify(status)==V_C_TRY_AGAIN) +#define V_FAIL(status) (err_classify(status)==V_C_FAIL) +#define V_DEFINITE(status) (err_classify(status)==V_C_DEFINITE) + +#define V_STATUS(vinfo) ((VS_Status)*((vinfo).status)) + /* grumble... this abstraction should be in v.h... */ + +/* the main routines */ + +#if defined(MEWEL) || defined(WINDOWS) +#ifndef NOCODECOVER +extern VS_Request _far _cdecl VSFormRequest(char FAR *name, char FAR *version, + char FAR *ininame, char FAR *codecover, HWND hWnd, + int HowToCheck); +#else +extern VS_Request _far _cdecl VSFormRequest(char FAR *name, char FAR *version, + char FAR *ininame, HWND hWnd, + int HowToCheck); +#endif + +#else +extern VS_Request _far _cdecl VSFormRequest(char *name, char *version, int HowToCheck); +#endif + +extern VS_Status _far _cdecl VSProcessRequest(VS_Request request); +#if defined(WINDOWS) || defined(MEWEL) +extern void _far _cdecl WinVSReportRequest(VS_Request request, HWND hWnd, char FAR *title); +extern void _far _cdecl TTChangeRegistration(char FAR *ininame, HWND hWnd, LPSTR DlgBoxName); +extern BOOL _far _cdecl v_complain(VS_Status error, LPSTR inifilename); +#else +extern void _far _cdecl TTYVSReportRequest(VS_Request request); +#endif +extern void _far _cdecl VSDestroyRequest(VS_Request request); +extern void _far _cdecl PickVersionServer(char FAR *name); +#define HNAMESIZE 40 /* max. chars in the VS server name. */ +#define HSPSIZE 2 /* no. chars in send packets option */ + +#ifndef VS_INTERNAL +extern VS_Request _far _cdecl MakeRequest( VS_Status status ); +extern VS_Status _far _cdecl ReqStatus ( VS_Request hrequest ); +#endif + +#endif /* VS_HEADER_STUFF */ + +/* + * The application should call the first two routines, and optionally + * the third, in order. It should only quit if CheckVS returns V_REQUIRED. + * If this is a Windows/Mewel program, a call to PostQuitMessage(0) is the + * best way to do things, unless some cleanup needs to be done... but the + * Version Server checking should be done as early as possible so this + * shouldn't be a problem. + */ + +#if 0 +/* here's an example: */ + VS_Request request; + VS_Status status; + + request = VSFormRequest(APPLICATION_NAME, APP_VER, "1st alpha"); + status = VSProcessRequest(request); + WinVSReportRequest(request, hMainWin, "Version Server Status Report"); + if (status == V_REQUIRED) + PostQuitMessage(0); /* This is an outdated version of TechInfo! */ + VSDestroyRequest(request); +#endif diff --git a/src/mit/windows/include/vs_nt.h b/src/mit/windows/include/vs_nt.h new file mode 100644 index 000000000..d1f9c6d01 --- /dev/null +++ b/src/mit/windows/include/vs_nt.h @@ -0,0 +1,42 @@ +#include "mitcpyrt.h" + +/* il 7/24/95 -- adding nt */ + +#ifndef _vs_nt_h_ +#define _ve_nt_h_ + +#ifdef _WIN32 + + + +/* the #undef instructions are not needed, but left to avoid possible + * conflicts with windows.h's similar definitions */ + +#undef FAR +#undef far +#undef _far +#undef __far + +#define FAR +#define far +#define _far +#define __far + +#undef _osmajor +#undef _osmanor +#define _osmajor _winmajor +#define _osminor _winminor + +#undef _fstrlen +#undef _fstrcat +#define _fstrlen strlen +#define _fstrcat strcat + +#include + + +#undef WINDOWS +#define WINDOWS + +#endif +#endif diff --git a/src/mit/windows/lib/vsnt.lib b/src/mit/windows/lib/vsnt.lib new file mode 100644 index 000000000..badf6d459 Binary files /dev/null and b/src/mit/windows/lib/vsnt.lib differ diff --git a/src/mit/windows/lib/vswin.lib b/src/mit/windows/lib/vswin.lib new file mode 100644 index 000000000..561f7849f Binary files /dev/null and b/src/mit/windows/lib/vswin.lib differ