Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / matrixssl / matrixCommon.h
blob1081617fab97b5bf83f758e64ef6f19753e4248e
1 /*
2 * matrixCommon.h
3 * Release $Name: MATRIXSSL_1_8_8_OPEN $
4 *
5 * Public common header file
6 */
7 /*
8 * Copyright (c) PeerSec Networks, 2002-2009. All Rights Reserved.
9 * The latest version of this code is available at http://www.matrixssl.org
11 * This software is open source; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This General Public License does NOT permit incorporating this software
17 * into proprietary programs. If you are unable to comply with the GPL, a
18 * commercial license for this software may be purchased from PeerSec Networks
19 * at http://www.peersec.com
21 * This program is distributed in WITHOUT ANY WARRANTY; without even the
22 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 * See the GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 * http://www.gnu.org/copyleft/gpl.html
30 /******************************************************************************/
32 #ifndef _h_MATRIXCOMMON
33 #define _h_MATRIXCOMMON
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
39 #include "src/matrixConfig.h"
41 /******************************************************************************/
43 Platform integer sizes
45 typedef int int32;
46 typedef unsigned int uint32;
48 /******************************************************************************/
50 Helpers
52 #ifndef VXWORKS
53 #ifndef min
54 #define min(a,b) (((a) < (b)) ? (a) : (b))
55 #endif /* min */
57 #ifndef max
58 #define max(a,b) (((a) > (b)) ? (a) : (b))
59 #endif /* max */
60 #endif /* VXWORKS */
62 /******************************************************************************/
64 Flags for matrixSslNewSession
66 #define SSL_FLAGS_SERVER 0x1
67 #define SSL_FLAGS_CLIENT_AUTH 0x200
69 /******************************************************************************/
71 matrixSslSetSessionOption defines
73 #define SSL_OPTION_DELETE_SESSION 0
76 /******************************************************************************/
78 Typdefs required for public apis. From an end user perspective, the
79 sslBuf_t and sslCertInfo_t types have internal fields that are public,
80 but ssl_t, sslKeys_t, sslCert_t,and sslSessionId_t do not. Defining
81 those as 'int32' requires it to be treated as an opaque data type to be
82 passed to public apis
84 #ifndef _h_EXPORT_SYMBOLS
86 typedef int32 ssl_t;
87 typedef int32 sslKeys_t;
88 typedef int32 sslSessionId_t;
89 typedef int32 sslCert_t;
91 /******************************************************************************/
93 Explicitly import MATRIXPUBLIC apis on Windows. If we're being included
94 from an internal header, we export them instead!
96 #ifdef WIN32
97 #define MATRIXPUBLIC extern __declspec(dllimport)
98 #endif /* WIN */
99 #else /* h_EXPORT_SYMOBOLS */
100 #ifdef WIN32
101 #define MATRIXPUBLIC extern __declspec(dllexport)
102 #endif /* WIN */
103 #endif /* h_EXPORT_SYMOBOLS */
104 #ifndef WIN32
105 #define MATRIXPUBLIC extern
106 #endif /* !WIN */
108 /******************************************************************************/
110 Public structures
112 sslBuf_t
113 Empty buffer:
114 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
115 |.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|
117 \end
118 \start
119 \buf
120 size = 16
121 len = (end - start) = 0
123 Buffer with data:
125 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
126 |.|.|a|b|c|d|e|f|g|h|i|j|.|.|.|.|
127 ^ ^ ^
128 | | \end
129 | \start
130 \buf
131 size = 16
132 len = (end - start) = 10
134 Read from start pointer
135 Write to end pointer
137 typedef struct {
138 unsigned char *buf; /* Pointer to the start of the buffer */
139 unsigned char *start; /* Pointer to start of valid data */
140 unsigned char *end; /* Pointer to first byte of invalid data */
141 int32 size; /* Size of buffer in bytes */
142 } sslBuf_t;
145 /******************************************************************************/
147 Information provided to user callback for validating certificates.
148 Register callback with call to matrixSslSetCertValidator
150 typedef struct {
151 char *country;
152 char *state;
153 char *locality;
154 char *organization;
155 char *orgUnit;
156 char *commonName;
157 } sslDistinguishedName_t;
159 typedef struct sslSubjectAltNameEntry {
160 int32 id;
161 unsigned char name[16];
162 unsigned char *data;
163 int32 dataLen;
164 struct sslSubjectAltNameEntry *next;
165 } sslSubjectAltName_t;
167 typedef struct sslCertInfo {
168 int32 verified;
169 unsigned char *serialNumber;
170 int32 serialNumberLen;
171 char *notBefore;
172 char *notAfter;
173 char *sigHash;
174 int32 sigHashLen;
175 sslSubjectAltName_t *subjectAltName;
176 sslDistinguishedName_t subject;
177 sslDistinguishedName_t issuer;
178 struct sslCertInfo *next;
179 } sslCertInfo_t;
181 /******************************************************************************/
183 #ifdef __cplusplus
185 #endif
187 #endif /* _h_MATRIXCOMMON */
189 /******************************************************************************/