5151#define TCN_ASSERT (x ) (void)0
5252#endif
5353
54- #ifndef APR_MAX_IOVEC_SIZE
55- #define APR_MAX_IOVEC_SIZE 1024
56- #endif
57-
58- #define TCN_TIMEUP APR_OS_START_USERERR + 1
59- #define TCN_EAGAIN APR_OS_START_USERERR + 2
60- #define TCN_EINTR APR_OS_START_USERERR + 3
61- #define TCN_EINPROGRESS APR_OS_START_USERERR + 4
62- #define TCN_ETIMEDOUT APR_OS_START_USERERR + 5
63-
64- #define TCN_LOG_EMERG 1
65- #define TCN_LOG_ERROR 2
66- #define TCN_LOG_NOTICE 3
67- #define TCN_LOG_WARN 4
68- #define TCN_LOG_INFO 5
69- #define TCN_LOG_DEBUG 6
70-
71- #define TCN_ERROR_WRAP (E ) \
72- if (APR_STATUS_IS_TIMEUP(E)) \
73- (E) = TCN_TIMEUP; \
74- else if (APR_STATUS_IS_EAGAIN(E)) \
75- (E) = TCN_EAGAIN; \
76- else if (APR_STATUS_IS_EINTR(E)) \
77- (E) = TCN_EINTR; \
78- else if (APR_STATUS_IS_EINPROGRESS(E)) \
79- (E) = TCN_EINPROGRESS; \
80- else if (APR_STATUS_IS_ETIMEDOUT(E)) \
81- (E) = TCN_ETIMEDOUT; \
82- else \
83- (E) = (E)
84-
8554#define TCN_CLASS_PATH "org/apache/tomcat/jni/"
86- #define TCN_FINFO_CLASS TCN_CLASS_PATH "FileInfo"
87- #define TCN_AINFO_CLASS TCN_CLASS_PATH "Sockaddr"
8855#define TCN_ERROR_CLASS TCN_CLASS_PATH "Error"
8956#define TCN_PARENT_IDE "TCN_PARENT_ID"
9057
10067/* On stack buffer size */
10168#define TCN_BUFFER_SZ 8192
10269#define TCN_STDARGS JNIEnv *e, jobject o
103- #define TCN_IMPARGS JNIEnv *e, jobject o, void *sock
104- #define TCN_IMPCALL (X ) e, o, X->opaque
10570
10671#define TCN_IMPLEMENT_CALL (RT , CL , FN ) \
10772 JNIEXPORT RT JNICALL Java_org_apache_tomcat_jni_##CL##_##FN
10873
109- #define TCN_IMPLEMENT_METHOD (RT , FN ) \
110- static RT method_##FN
111-
112- #define TCN_GETNET_METHOD (FN ) method_##FN
113-
11474/* Private helper functions */
11575void tcn_Throw (JNIEnv * , const char * , ...);
11676void tcn_ThrowException (JNIEnv * , const char * );
@@ -120,9 +80,6 @@ jstring tcn_new_stringn(JNIEnv *, const char *, size_t);
12080unsigned long tcn_get_thread_id (void );
12181
12282#define J2S (V ) c##V
123- #define J2L (V ) p##V
124-
125- #define J2T (T ) (apr_time_t)((T))
12683
12784#define TCN_BEGIN_MACRO if (1) {
12885#define TCN_END_MACRO } else (void)(0)
@@ -135,12 +92,6 @@ unsigned long tcn_get_thread_id(void);
13592
13693#define AJP_TO_JSTRING (V ) (*e)->NewStringUTF((e), (V))
13794
138- #define TCN_FREE_JSTRING (V ) \
139- TCN_BEGIN_MACRO \
140- if (c##V) \
141- free(c##V); \
142- TCN_END_MACRO
143-
14495#define TCN_THROW_IF_ERR (x , r ) \
14596 TCN_BEGIN_MACRO \
14697 apr_status_t R = (x); \
@@ -168,9 +119,6 @@ unsigned long tcn_get_thread_id(void);
168119#define TCN_UNLOAD_CLASS (E , C ) \
169120 (*(E))->DeleteGlobalRef((E), (C))
170121
171- #define TCN_IS_NULL (E , O ) \
172- ((*(E))->IsSameObject((E), (O), NULL) == JNI_TRUE)
173-
174122#define TCN_GET_METHOD (E , C , M , N , S , R ) \
175123 TCN_BEGIN_MACRO \
176124 M = (*(E))->GetMethodID((E), C, N, S); \
@@ -179,54 +127,4 @@ unsigned long tcn_get_thread_id(void);
179127 } \
180128 TCN_END_MACRO
181129
182- #define TCN_MAX_METHODS 8
183-
184- #define TCN_MIN (a , b ) ((a) < (b) ? (a) : (b))
185- #define TCN_MAX (a , b ) ((a) > (b) ? (a) : (b))
186-
187- #ifdef WIN32
188- #define TCN_ALLOC_WSTRING (V ) \
189- jsize wl##V = (*e)->GetStringLength(e, V); \
190- const jchar *ws##V = V ? (const jchar *)((*e)->GetStringChars(e, V, 0)) : NULL; \
191- jchar *w##V = NULL
192-
193- #define TCN_INIT_WSTRING (V ) \
194- w##V = (jchar *)malloc((wl##V + 1) * sizeof(jchar)); \
195- wcsncpy(w##V, ws##V, wl##V); \
196- w##V[wl##V] = 0
197-
198- #define TCN_FREE_WSTRING (V ) \
199- if (ws##V) (*e)->ReleaseStringChars(e, V, ws##V); \
200- if (ws##V) free (w##V)
201-
202- #define J2W (V ) w##V
203-
204- #endif
205-
206- #if !APR_HAVE_IPV6
207- #define APR_INET6 APR_INET
208- #endif
209-
210- #ifdef APR_UNIX
211- #define GET_S_FAMILY (T , F ) \
212- if (F == 0) T = APR_UNSPEC; \
213- else if (F == 1) T = APR_INET; \
214- else if (F == 2) T = APR_INET6; \
215- else if (F == 3) T = APR_UNIX; \
216- else T = F
217- #else
218- #define GET_S_FAMILY (T , F ) \
219- if (F == 0) T = APR_UNSPEC; \
220- else if (F == 1) T = APR_INET; \
221- else if (F == 2) T = APR_INET6; \
222- else T = F
223- #endif
224-
225- #define GET_S_TYPE (T , F ) \
226- if (F == 0) T = SOCK_STREAM; \
227- else if (F == 1) T = SOCK_DGRAM; \
228- else T = F
229-
230- #define TCN_NO_SOCKET_TIMEOUT -2
231-
232130#endif /* TCN_H */
0 commit comments