| 1 |
Porting the Simple Sockets Library |
| 2 |
Dr. Charles E. Campbell, Jr. |
| 3 |
|
| 4 |
1. Most SSL porting issues are handled in the header file, "sockets.h". The |
| 5 |
leading portion of the file has several machine specific sections: |
| 6 |
|
| 7 |
#ifdef vms |
| 8 |
... |
| 9 |
#endif |
| 10 |
|
| 11 |
#ifdef apollo |
| 12 |
... |
| 13 |
#endif |
| 14 |
|
| 15 |
#ifdef sgi |
| 16 |
... |
| 17 |
#endif |
| 18 |
|
| 19 |
etc. |
| 20 |
|
| 21 |
These machine specific sections mostly contain #include <some tcp/ip header |
| 22 |
file> stuff; your new machine section must be set up to include the |
| 23 |
appropriate header files, too, but they'll probably have nearly the same |
| 24 |
set of header file names. |
| 25 |
|
| 26 |
Each machine section also usually has a |
| 27 |
|
| 28 |
#ifdef SSLNEEDTIME |
| 29 |
... |
| 30 |
#endif |
| 31 |
|
| 32 |
subsection which includes the time header file information needed by select(). |
| 33 |
|
| 34 |
2. Some machines have case insensitive linkers, such as MS-DOS. The usual solution |
| 35 |
is to put |
| 36 |
|
| 37 |
# define Sscanf Sktscanf |
| 38 |
# define Sprintf Sktprintf |
| 39 |
|
| 40 |
in the machine-specific section. |
| 41 |
|
| 42 |
3. There are three options for the SSL that support different machines: |
| 43 |
|
| 44 |
#define SSLNOSETSOCKOPT |
| 45 |
#define SSLNOPEEK |
| 46 |
#define SSLNEEDTOSHAREPM |
| 47 |
|
| 48 |
The SSLNOSETSOCKOPT is for those machines whose Berkeley sockets API does |
| 49 |
not support the setsockopt() function (or, if present, doesn't support the |
| 50 |
TCP_NODELAY option). |
| 51 |
|
| 52 |
The SSLNOPEEK is for those machines whose Berkeley sockets API does not |
| 53 |
support the MSG_PEEK option on a recv(). |
| 54 |
|
| 55 |
The SSLNEEDTOSHAREPM is for those machines which lack multi-tasking; ie. |
| 56 |
cannot run a PortMaster in the background. Those machines need to share |
| 57 |
another machine's PortMaster for any servers to be run on them. Clients are |
| 58 |
unaffected. |
| 59 |
|
| 60 |
4. There are a few MSDOS exceptions in <Sopen.c> and <Sscanf.c>. |
| 61 |
|
| 62 |
The <Sopen.c> ones initialize the WIN/API DOS Socket Library. If your |
| 63 |
tcp/ip Berkeley sockets requires a call to some initialization function, |
| 64 |
this is the place to do it. |
| 65 |
|
| 66 |
The <Sscanf.c> MSDOS exceptions support MicroSoft C's requirement to have |
| 67 |
its first argument to va_start() and va_arg() be "char *" instead of "void |
| 68 |
*". |
| 69 |
|
| 70 |
5. Some middle-aged C compilers allowed prototyping, but were not ANSI-C |
| 71 |
compliant. In <xtdio.h>, at or near line 78, is a preprocessor block: |
| 72 |
|
| 73 |
# if defined(sgi) || defined(apollo) || defined(__STDC__) || \ |
| 74 |
defined(MSDOS) || defined(MCH_AMIGA) || defined(__osf__) |
| 75 |
# define __PROTOTYPE__ |
| 76 |
... |
| 77 |
|
| 78 |
If your machine's compiler fits this bill, you should (this is not |
| 79 |
required, merely suggested) put it on the #if defined() ... list of |
| 80 |
machines so that the compiler would use prototyping. Prototyping will |
| 81 |
likely save you some syntax errors in your future. |
| 82 |
|
| 83 |
One caveat: the cprt() and sprt() functions use the keyword "const". Your |
| 84 |
middle-aged C compiler may, or may not, support that keyword. If not, |
| 85 |
you'll be getting some syntax errors from the <xtdio.h> line near the |
| 86 |
prototypes for those two functions. The solution is simple: in <xtdio.h> |
| 87 |
near line 94 is |
| 88 |
|
| 89 |
#define const |
| 90 |
|
| 91 |
buried inside a comment about this problem. Move that line out of the |
| 92 |
comment, and the "const" problems should disappear. |
| 93 |
|
| 94 |
6. SCO/Unix sockets: You may need additional network products such as |
| 95 |
|
| 96 |
SCO Unix 3.2v4: |
| 97 |
- SCO Unix runtime |
| 98 |
- SCO Unix Development System |
| 99 |
- SCO TCP/IP Runtime |
| 100 |
- SCO TCP/IP Development System |
| 101 |
|
| 102 |
Open Desktop 2 or 3: ODT Development System |
| 103 |
|
| 104 |
OpenServer 5: all include files and libraries are already supplied with the o/s |
| 105 |
|
| 106 |
Note -- I (C Campbell) have never used SCO, so I can not personally attest as to |
| 107 |
what your SCO variant may or may not need. |