Apache HTTPD
libprews.c
Go to the documentation of this file.
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#include <netware.h>
17#include <library.h>
18#include <nks/synch.h>
19
20#include "apr_pools.h"
21#include "apr_private.h"
22#include "apr_arch_internal_time.h"
23
24
25/* library-private data...*/
26int gLibId = -1;
27void *gLibHandle = (void *) NULL;
29
30/* internal library function prototypes...*/
31int DisposeLibraryData(void *);
32
34(
35 void *NLMHandle,
36 void *errorScreen,
37 const char *cmdLine,
38 const char *loadDirPath,
40 void *NLMFileHandle,
41 int (*readRoutineP)( int conn, void *fileHandle, size_t offset,
42 size_t nbytes, size_t *bytesRead, void *buffer ),
43 size_t customDataOffset,
44 size_t customDataSize,
45 int messageCount,
46 const char **messages
47)
48{
49#ifdef USE_WINSOCK
51#endif
53
54 NX_LOCK_INFO_ALLOC(liblock, "Per-Application Data Lock", 0);
55
56#pragma unused(cmdLine)
57#pragma unused(loadDirPath)
58#pragma unused(uninitializedDataLength)
59#pragma unused(NLMFileHandle)
60#pragma unused(readRoutineP)
61#pragma unused(customDataOffset)
62#pragma unused(customDataSize)
63#pragma unused(messageCount)
64#pragma unused(messages)
65
67
68 if (gLibId < -1)
69 {
70 OutputToScreen(errorScreen, "Unable to register library with kernel.\n");
71 return -1;
72 }
73
75
77
78 if (!gLibLock)
79 {
80 OutputToScreen(errorScreen, "Unable to allocate library data lock.\n");
81 return -1;
82 }
83
85
87 return status;
88
89#ifdef USE_WINSOCK
90 return WSAStartup((WORD) MAKEWORD(2, 0), &wsaData);
91#else
92 return 0;
93#endif
94}
95
96void _NonAppStop( void )
97{
99
100#ifdef USE_WINSOCK
101 WSACleanup();
102#endif
103
106}
107
109{
110 return 0;
111}
112
114{
116
118 if (!app_data) {
120
121 if (app_data) {
122 memset (app_data, 0, sizeof(APP_DATA));
124 app_data->gs_nlmhandle = NLMHandle;
125 }
126 }
127
128 if (app_data && (!app_data->initialized)) {
129 app_data->initialized = 1;
131 return 0;
132 }
133
135 return 1;
136}
137
139{
141
143 if (app_data) {
144 app_data->initialized = 0;
146 return 0;
147 }
149 return 1;
150}
151
153{
154 if (data)
155 {
157 }
158
159 return 0;
160}
161
163{
165
167
168 if (app_data && !app_data->gPool) {
169 app_data->gPool = data;
170 }
171
173 return 1;
174}
175
177{
179
180 if (app_data) {
181 return app_data->gPool;
182 }
183
184 return NULL;
185}
186
APR memory allocation.
apr_size_t size
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
void apr_size_t * nbytes
apr_seek_where_t apr_off_t * offset
void * data
char * buffer
int int status
return NULL
Definition mod_so.c:359
void _NonAppStop(void)
Definition libprews.c:67
int _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)
Definition libprews.c:33
int _NonAppCheckUnload(void)
Definition libprews.c:76
void apr_netware_setup_time(void)
int register_NLM(void *NLMHandle)
Definition libprews.c:113
void * gLibHandle
Definition libprews.c:27
int gLibId
Definition libprews.c:26
void * getGlobalPool()
Definition libprews.c:176
int setGlobalPool(void *data)
Definition libprews.c:162
int unregister_NLM(void *NLMHandle)
Definition libprews.c:138
NXMutex_t * gLibLock
Definition libprews.c:28
int DisposeLibraryData(void *)
Definition libprews.c:152