1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements.  See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License.  You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*------------------------------------------------------------------
18   These functions are to be called when the shared NLM starts and
19   stops.  By using these functions instead of defining a main()
20   and calling ExitThread(TSR_THREAD, 0), the load time of the
21   shared NLM is faster and memory size reduced.
22 
23   You may also want to override these in your own Apache module
24   to do any cleanup other than the mechanism Apache modules
25   provide.
26 ------------------------------------------------------------------*/
27 #include <netware.h>
28 #ifdef USE_WINSOCK
29 #include <novsock2.h>
30 #endif
31 
_NonAppStart(void * NLMHandle,void * errorScreen,const char * cmdLine,const char * loadDirPath,size_t uninitializedDataLength,void * NLMFileHandle,int (* readRoutineP)(int conn,void * fileHandle,size_t offset,size_t nbytes,size_t * bytesRead,void * buffer),size_t customDataOffset,size_t customDataSize,int messageCount,const char ** messages)32 int _NonAppStart
33 (
34     void        *NLMHandle,
35     void        *errorScreen,
36     const char  *cmdLine,
37     const char  *loadDirPath,
38     size_t      uninitializedDataLength,
39     void        *NLMFileHandle,
40     int         (*readRoutineP)( int conn, void *fileHandle, size_t offset,
41                     size_t nbytes, size_t *bytesRead, void *buffer ),
42     size_t      customDataOffset,
43     size_t      customDataSize,
44     int         messageCount,
45     const char  **messages
46 )
47 {
48 #pragma unused(cmdLine)
49 #pragma unused(loadDirPath)
50 #pragma unused(uninitializedDataLength)
51 #pragma unused(NLMFileHandle)
52 #pragma unused(readRoutineP)
53 #pragma unused(customDataOffset)
54 #pragma unused(customDataSize)
55 #pragma unused(messageCount)
56 #pragma unused(messages)
57 
58 #ifdef USE_WINSOCK
59     WSADATA wsaData;
60 
61     return WSAStartup((WORD) MAKEWORD(2, 0), &wsaData);
62 #else
63     return 0;
64 #endif
65 }
66 
_NonAppStop(void)67 void _NonAppStop( void )
68 {
69 #ifdef USE_WINSOCK
70     WSACleanup();
71 #else
72     return;
73 #endif
74 }
75 
_NonAppCheckUnload(void)76 int  _NonAppCheckUnload( void )
77 {
78     return 0;
79 }
80