KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tomcat > jni > SSLSocket


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.tomcat.jni;
19
20 /** SSL Socket
21  *
22  * @author Mladen Turk
23  * @version $Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
24  */

25
26 public class SSLSocket {
27
28     /**
29      * Attach APR socket on a SSL connection.
30      * @param ctx SSLContext to use.
31      * @param sock APR Socket that already did physical connect or accept.
32      * @return APR_STATUS code.
33      */

34     public static native int attach(long ctx, long sock)
35         throws Exception JavaDoc;
36
37     /**
38      * Do a SSL handshake.
39      * @param thesocket The socket to use
40      */

41     public static native int handshake(long thesocket);
42
43     /**
44      * Do a SSL renegotiation.
45      * SSL supports per-directory re-configuration of SSL parameters.
46      * This is implemented by performing an SSL renegotiation of the
47      * re-configured parameters after the request is read, but before the
48      * response is sent. In more detail: the renegotiation happens after the
49      * request line and MIME headers were read, but _before_ the attached
50      * request body is read. The reason simply is that in the HTTP protocol
51      * usually there is no acknowledgment step between the headers and the
52      * body (there is the 100-continue feature and the chunking facility
53      * only), so Apache has no API hook for this step.
54      *
55      * @param thesocket The socket to use
56      */

57     public static native int renegotiate(long thesocket);
58
59     /**
60      * Retrun SSL Info parameter as byte array.
61      *
62      * @param sock The socket to read the data from.
63      * @param id Parameter id.
64      * @return Byte array containing info id value.
65      */

66     public static native byte[] getInfoB(long sock, int id)
67         throws Exception JavaDoc;
68
69     /**
70      * Retrun SSL Info parameter as String.
71      *
72      * @param sock The socket to read the data from.
73      * @param id Parameter id.
74      * @return String containing info id value.
75      */

76     public static native String JavaDoc getInfoS(long sock, int id)
77         throws Exception JavaDoc;
78
79     /**
80      * Retrun SSL Info parameter as integer.
81      *
82      * @param sock The socket to read the data from.
83      * @param id Parameter id.
84      * @return Integer containing info id value or -1 on error.
85      */

86     public static native int getInfoI(long sock, int id)
87         throws Exception JavaDoc;
88
89 }
90
Popular Tags