BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJLIB Reference

ssl_sock.h
Go to the documentation of this file.
1 /* $Id$ */
2 /*
3  * Copyright (C) 2009-2011 Teluu Inc. (http://www.teluu.com)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19 #ifndef __PJ_SSL_SOCK_H__
20 #define __PJ_SSL_SOCK_H__
21 
27 #include <pj/ioqueue.h>
28 #include <pj/sock.h>
29 #include <pj/sock_qos.h>
30 
31 
33 
54 
55 
61 
62 
64 {
69 
74 
79 
84 
90 
95 
102 
107 
112 
117 
125 
130 
132 
133 
134 typedef enum pj_ssl_cert_name_type
135 {
136  PJ_SSL_CERT_NAME_UNKNOWN = 0,
137  PJ_SSL_CERT_NAME_RFC822,
138  PJ_SSL_CERT_NAME_DNS,
139  PJ_SSL_CERT_NAME_URI,
140  PJ_SSL_CERT_NAME_IP
141 } pj_ssl_cert_name_type;
142 
146 typedef struct pj_ssl_cert_info {
147 
148  unsigned version;
154  struct {
159  } subject;
161  struct {
162  pj_str_t cn;
163  pj_str_t info;
165  } issuer;
167  struct {
172  } validity;
174  struct {
175  unsigned cnt;
176  struct {
177  pj_ssl_cert_name_type type;
180  } *entry;
181  } subj_alt_name;
187  struct {
188  unsigned cnt;
189  pj_str_t *cert_raw;
190  } raw_chain;
191 
193 
198 
214  const pj_str_t *CA_file,
215  const pj_str_t *cert_file,
216  const pj_str_t *privkey_file,
217  const pj_str_t *privkey_pass,
218  pj_ssl_cert_t **p_cert);
219 
240  pj_pool_t *pool,
241  const pj_str_t *CA_file,
242  const pj_str_t *CA_path,
243  const pj_str_t *cert_file,
244  const pj_str_t *privkey_file,
245  const pj_str_t *privkey_pass,
246  pj_ssl_cert_t **p_cert);
247 
248 
262  const pj_ssl_cert_buffer *CA_buf,
263  const pj_ssl_cert_buffer *cert_buf,
264  const pj_ssl_cert_buffer *privkey_buf,
265  const pj_str_t *privkey_pass,
266  pj_ssl_cert_t **p_cert);
267 
280  const char *indent,
281  char *buf,
282  pj_size_t buf_size);
283 
284 
298  pj_uint32_t verify_status,
299  const char *error_strings[],
300  unsigned *count);
301 
308 PJ_DECL(void) pj_ssl_cert_wipe_keys(pj_ssl_cert_t *cert);
309 
310 
314 typedef enum pj_ssl_cipher {
315 
316  /* Unsupported cipher */
317  PJ_TLS_UNKNOWN_CIPHER = -1,
318 
319  /* NULL */
320  PJ_TLS_NULL_WITH_NULL_NULL = 0x00000000,
321 
322  /* TLS/SSLv3 */
323  PJ_TLS_RSA_WITH_NULL_MD5 = 0x00000001,
324  PJ_TLS_RSA_WITH_NULL_SHA = 0x00000002,
325  PJ_TLS_RSA_WITH_NULL_SHA256 = 0x0000003B,
326  PJ_TLS_RSA_WITH_RC4_128_MD5 = 0x00000004,
327  PJ_TLS_RSA_WITH_RC4_128_SHA = 0x00000005,
328  PJ_TLS_RSA_WITH_3DES_EDE_CBC_SHA = 0x0000000A,
329  PJ_TLS_RSA_WITH_AES_128_CBC_SHA = 0x0000002F,
330  PJ_TLS_RSA_WITH_AES_256_CBC_SHA = 0x00000035,
331  PJ_TLS_RSA_WITH_AES_128_CBC_SHA256 = 0x0000003C,
332  PJ_TLS_RSA_WITH_AES_256_CBC_SHA256 = 0x0000003D,
333  PJ_TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA = 0x0000000D,
334  PJ_TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA = 0x00000010,
335  PJ_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 0x00000013,
336  PJ_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 0x00000016,
337  PJ_TLS_DH_DSS_WITH_AES_128_CBC_SHA = 0x00000030,
338  PJ_TLS_DH_RSA_WITH_AES_128_CBC_SHA = 0x00000031,
339  PJ_TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 0x00000032,
340  PJ_TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x00000033,
341  PJ_TLS_DH_DSS_WITH_AES_256_CBC_SHA = 0x00000036,
342  PJ_TLS_DH_RSA_WITH_AES_256_CBC_SHA = 0x00000037,
343  PJ_TLS_DHE_DSS_WITH_AES_256_CBC_SHA = 0x00000038,
344  PJ_TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 0x00000039,
345  PJ_TLS_DH_DSS_WITH_AES_128_CBC_SHA256 = 0x0000003E,
346  PJ_TLS_DH_RSA_WITH_AES_128_CBC_SHA256 = 0x0000003F,
347  PJ_TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 = 0x00000040,
348  PJ_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 = 0x00000067,
349  PJ_TLS_DH_DSS_WITH_AES_256_CBC_SHA256 = 0x00000068,
350  PJ_TLS_DH_RSA_WITH_AES_256_CBC_SHA256 = 0x00000069,
351  PJ_TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 = 0x0000006A,
352  PJ_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 = 0x0000006B,
353  PJ_TLS_DH_anon_WITH_RC4_128_MD5 = 0x00000018,
354  PJ_TLS_DH_anon_WITH_3DES_EDE_CBC_SHA = 0x0000001B,
355  PJ_TLS_DH_anon_WITH_AES_128_CBC_SHA = 0x00000034,
356  PJ_TLS_DH_anon_WITH_AES_256_CBC_SHA = 0x0000003A,
357  PJ_TLS_DH_anon_WITH_AES_128_CBC_SHA256 = 0x0000006C,
358  PJ_TLS_DH_anon_WITH_AES_256_CBC_SHA256 = 0x0000006D,
359 
360  /* TLS (deprecated) */
361  PJ_TLS_RSA_EXPORT_WITH_RC4_40_MD5 = 0x00000003,
362  PJ_TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = 0x00000006,
363  PJ_TLS_RSA_WITH_IDEA_CBC_SHA = 0x00000007,
364  PJ_TLS_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x00000008,
365  PJ_TLS_RSA_WITH_DES_CBC_SHA = 0x00000009,
366  PJ_TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x0000000B,
367  PJ_TLS_DH_DSS_WITH_DES_CBC_SHA = 0x0000000C,
368  PJ_TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x0000000E,
369  PJ_TLS_DH_RSA_WITH_DES_CBC_SHA = 0x0000000F,
370  PJ_TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x00000011,
371  PJ_TLS_DHE_DSS_WITH_DES_CBC_SHA = 0x00000012,
372  PJ_TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x00000014,
373  PJ_TLS_DHE_RSA_WITH_DES_CBC_SHA = 0x00000015,
374  PJ_TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 = 0x00000017,
375  PJ_TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA = 0x00000019,
376  PJ_TLS_DH_anon_WITH_DES_CBC_SHA = 0x0000001A,
377 
378  /* SSLv3 */
379  PJ_SSL_FORTEZZA_KEA_WITH_NULL_SHA = 0x0000001C,
380  PJ_SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA = 0x0000001D,
381  PJ_SSL_FORTEZZA_KEA_WITH_RC4_128_SHA = 0x0000001E,
382 
383  /* SSLv2 */
384  PJ_SSL_CK_RC4_128_WITH_MD5 = 0x00010080,
385  PJ_SSL_CK_RC4_128_EXPORT40_WITH_MD5 = 0x00020080,
386  PJ_SSL_CK_RC2_128_CBC_WITH_MD5 = 0x00030080,
387  PJ_SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5 = 0x00040080,
388  PJ_SSL_CK_IDEA_128_CBC_WITH_MD5 = 0x00050080,
389  PJ_SSL_CK_DES_64_CBC_WITH_MD5 = 0x00060040,
390  PJ_SSL_CK_DES_192_EDE3_CBC_WITH_MD5 = 0x000700C0
391 
392 } pj_ssl_cipher;
393 
394 
404  unsigned *cipher_num);
405 
406 
415 
416 
425 PJ_DECL(const char*) pj_ssl_cipher_name(pj_ssl_cipher cipher);
426 
427 
438 PJ_DECL(pj_ssl_cipher) pj_ssl_cipher_id(const char *cipher_name);
439 
443 typedef enum pj_ssl_curve
444 {
445  PJ_TLS_UNKNOWN_CURVE = 0,
446  PJ_TLS_CURVE_SECT163K1 = 1,
447  PJ_TLS_CURVE_SECT163R1 = 2,
448  PJ_TLS_CURVE_SECT163R2 = 3,
449  PJ_TLS_CURVE_SECT193R1 = 4,
450  PJ_TLS_CURVE_SECT193R2 = 5,
451  PJ_TLS_CURVE_SECT233K1 = 6,
452  PJ_TLS_CURVE_SECT233R1 = 7,
453  PJ_TLS_CURVE_SECT239K1 = 8,
454  PJ_TLS_CURVE_SECT283K1 = 9,
455  PJ_TLS_CURVE_SECT283R1 = 10,
456  PJ_TLS_CURVE_SECT409K1 = 11,
457  PJ_TLS_CURVE_SECT409R1 = 12,
458  PJ_TLS_CURVE_SECT571K1 = 13,
459  PJ_TLS_CURVE_SECT571R1 = 14,
460  PJ_TLS_CURVE_SECP160K1 = 15,
461  PJ_TLS_CURVE_SECP160R1 = 16,
462  PJ_TLS_CURVE_SECP160R2 = 17,
463  PJ_TLS_CURVE_SECP192K1 = 18,
464  PJ_TLS_CURVE_SECP192R1 = 19,
465  PJ_TLS_CURVE_SECP224K1 = 20,
466  PJ_TLS_CURVE_SECP224R1 = 21,
467  PJ_TLS_CURVE_SECP256K1 = 22,
468  PJ_TLS_CURVE_SECP256R1 = 23,
469  PJ_TLS_CURVE_SECP384R1 = 24,
470  PJ_TLS_CURVE_SECP521R1 = 25,
471  PJ_TLS_CURVE_BRAINPOOLP256R1 = 26,
472  PJ_TLS_CURVE_BRAINPOOLP384R1 = 27,
473  PJ_TLS_CURVE_BRAINPOOLP512R1 = 28,
474  PJ_TLS_CURVE_ARBITRARY_EXPLICIT_PRIME_CURVES = 0XFF01,
475  PJ_TLS_CURVE_ARBITRARY_EXPLICIT_CHAR2_CURVES = 0XFF02
476 } pj_ssl_curve;
477 
487  unsigned *curve_num);
488 
497 
498 
507 PJ_DECL(const char*) pj_ssl_curve_name(pj_ssl_curve curve);
508 
519 PJ_DECL(pj_ssl_curve) pj_ssl_curve_id(const char *curve_name);
520 
521 /*
522  * Entropy enumeration
523  */
524 typedef enum pj_ssl_entropy
525 {
526  PJ_SSL_ENTROPY_NONE = 0,
527  PJ_SSL_ENTROPY_EGD = 1,
528  PJ_SSL_ENTROPY_RANDOM = 2,
529  PJ_SSL_ENTROPY_URANDOM = 3,
530  PJ_SSL_ENTROPY_FILE = 4,
531  PJ_SSL_ENTROPY_UNKNOWN = 0x0F
532 } pj_ssl_entropy_t;
533 
537 typedef struct pj_ssl_sock_cb
538 {
566  void *data,
567  pj_size_t size,
568  pj_status_t status,
569  pj_size_t *remainder);
591  void *data,
592  pj_size_t size,
593  const pj_sockaddr_t *src_addr,
594  int addr_len,
595  pj_status_t status);
596 
612  pj_ssize_t sent);
613 
630  pj_ssl_sock_t *newsock,
631  const pj_sockaddr_t *src_addr,
632  int src_addr_len);
652  pj_ssl_sock_t *newsock,
653  const pj_sockaddr_t *src_addr,
654  int src_addr_len,
655  pj_status_t status);
656 
670  pj_status_t status);
671 
673 
674 
679 typedef enum pj_ssl_sock_proto
680 {
685 
690 
695 
700 
705 
710 
715  PJ_SSL_SOCK_PROTO_SSL23 = (1 << 16) - 1,
716  PJ_SSL_SOCK_PROTO_ALL = PJ_SSL_SOCK_PROTO_SSL23,
717 
722 
724 
725 
729 typedef struct pj_ssl_sock_info
730 {
736 
742 
748 
753 
758 
763 
768 
773 
777  unsigned long last_native_err;
778 
783 
785 
786 
790 typedef struct pj_ssl_sock_param
791 {
802 
808  int sock_af;
809 
816 
822 
829 
834 
838  void *user_data;
839 
847 
860  unsigned async_cnt;
861 
876 
891 
901 
911 
918  unsigned ciphers_num;
919 
925 
933  unsigned curves_num;
934 
940 
950 
960  pj_ssl_entropy_t entropy_type;
961 
970 
978 
985 
993 
1004 
1012 
1021 
1030 
1038 
1046 
1055 
1057 
1058 
1067 
1072 
1079 
1084 
1089 
1091 
1092 
1099 PJ_DECL(void) pj_ssl_sock_param_default(pj_ssl_sock_param *param);
1100 
1101 
1109 PJ_DECL(void) pj_ssl_sock_param_copy(pj_pool_t *pool,
1110  pj_ssl_sock_param *dst,
1111  const pj_ssl_sock_param *src);
1112 
1113 
1124  const pj_ssl_sock_param *param,
1125  pj_ssl_sock_t **p_ssock);
1126 
1127 
1144  pj_ssl_sock_t *ssock,
1145  pj_pool_t *pool,
1146  const pj_ssl_cert_t *cert);
1147 
1148 
1158 
1159 
1173  void *user_data);
1174 
1183 PJ_DECL(void*) pj_ssl_sock_get_user_data(pj_ssl_sock_t *ssock);
1184 
1185 
1195  pj_ssl_sock_info *info);
1196 
1197 
1221  pj_pool_t *pool,
1222  unsigned buff_size,
1223  pj_uint32_t flags);
1224 
1240  pj_pool_t *pool,
1241  unsigned buff_size,
1242  void *readbuf[],
1243  pj_uint32_t flags);
1244 
1259  pj_pool_t *pool,
1260  unsigned buff_size,
1261  pj_uint32_t flags);
1262 
1278  pj_pool_t *pool,
1279  unsigned buff_size,
1280  void *readbuf[],
1281  pj_uint32_t flags);
1282 
1305  const void *data,
1306  pj_ssize_t *size,
1307  unsigned flags);
1308 
1332  const void *data,
1333  pj_ssize_t *size,
1334  unsigned flags,
1335  const pj_sockaddr_t *addr,
1336  int addr_len);
1337 
1338 
1360  pj_pool_t *pool,
1361  const pj_sockaddr_t *local_addr,
1362  int addr_len);
1363 
1364 
1381 PJ_DECL(pj_status_t)
1383  pj_pool_t *pool,
1384  const pj_sockaddr_t *local_addr,
1385  int addr_len,
1386  const pj_ssl_sock_param *newsock_param);
1387 
1388 
1408  pj_pool_t *pool,
1409  const pj_sockaddr_t *localaddr,
1410  const pj_sockaddr_t *remaddr,
1411  int addr_len);
1412 
1429  pj_ssl_sock_t *ssock,
1430  pj_ssl_start_connect_param *connect_param);
1431 
1447 
1453 
1454 #endif /* __PJ_SSL_SOCK_H__ */
pj_uint32_t proto
Definition: ssl_sock.h:846
unsigned cnt
Definition: ssl_sock.h:175
unsigned pj_sockaddr_get_len(const pj_sockaddr_t *addr)
pj_status_t pj_file_open(pj_pool_t *pool, const char *pathname, unsigned flags, pj_oshandle_t *fd)
size_t pj_size_t
Definition: types.h:58
@ PJ_SSL_CERT_EIDENTITY_NOT_MATCH
Definition: ssl_sock.h:124
pj_status_t pj_timer_heap_create(pj_pool_t *pool, pj_size_t count, pj_timer_heap_t **ht)
pj_status_t pj_gettimeofday(pj_time_val *tv)
pj_str_t entropy_path
Definition: ssl_sock.h:969
pj_size_t send_buffer_size
Definition: ssl_sock.h:900
pj_pool_t * pj_pool_create(pj_pool_factory *factory, const char *name, pj_size_t initial_size, pj_size_t increment_size, pj_pool_callback *callback)
pj_status_t pj_activesock_start_connect(pj_activesock_t *asock, pj_pool_t *pool, const pj_sockaddr_t *remaddr, int addr_len)
int pj_bool_t
Definition: types.h:71
struct pj_ssl_cert_info::@4 validity
pj_status_t pj_ssl_sock_start_accept(pj_ssl_sock_t *ssock, pj_pool_t *pool, const pj_sockaddr_t *local_addr, int addr_len)
pj_status_t pj_ssl_sock_close(pj_ssl_sock_t *ssock)
pj_ssl_curve pj_ssl_curve_id(const char *curve_name)
pj_str_t pj_ssl_cert_buffer
Definition: ssl_sock.h:197
pj_bool_t whole_data
Definition: ssl_sock.h:890
pj_size_t read_buffer_size
Definition: ssl_sock.h:910
struct pj_ssl_cert_info::@5 subj_alt_name
pj_status_t pj_ssl_cert_load_from_files(pj_pool_t *pool, const pj_str_t *CA_file, const pj_str_t *cert_file, const pj_str_t *privkey_file, const pj_str_t *privkey_pass, pj_ssl_cert_t **p_cert)
pj_status_t pj_sock_bind(pj_sock_t sockfd, const pj_sockaddr_t *my_addr, int addrlen)
pj_status_t pj_ssl_cipher_get_availables(pj_ssl_cipher ciphers[], unsigned *cipher_num)
Definition: activesock.c:270
pj_bool_t(* on_data_sent)(pj_ssl_sock_t *ssock, pj_ioqueue_op_key_t *send_key, pj_ssize_t sent)
Definition: ssl_sock.h:610
pj_status_t pj_ssl_sock_start_connect2(pj_ssl_sock_t *ssock, pj_ssl_start_connect_param *connect_param)
pj_pool_t * pool
Definition: ssl_sock.h:1066
@ PJ_SSL_SOCK_PROTO_DTLS1
Definition: ssl_sock.h:721
pj_str_t pj_str(char *str)
int concurrency
Definition: ssl_sock.h:875
pj_status_t pj_sock_getsockname(pj_sock_t sockfd, pj_sockaddr_t *addr, int *namelen)
pj_sockaddr local_addr
Definition: ssl_sock.h:752
pj_status_t pj_sock_listen(pj_sock_t sockfd, int backlog)
const char * pj_ssl_cipher_name(pj_ssl_cipher cipher)
int addr_len
Definition: ssl_sock.h:1088
pj_grp_lock_t * grp_lock
Definition: ssl_sock.h:801
void * pj_pool_calloc(pj_pool_t *pool, pj_size_t count, pj_size_t elem)
pj_bool_t(* on_data_read)(pj_activesock_t *asock, void *data, pj_size_t size, pj_status_t status, pj_size_t *remainder)
Definition: activesock.h:84
int sock_af
Definition: ssl_sock.h:808
#define PJ_SOMAXCONN
Definition: sock.h:477
#define PJ_IOQUEUE_MAX_HANDLES
Definition: config.h:679
pj_bool_t(* on_data_read)(pj_ssl_sock_t *ssock, void *data, pj_size_t size, pj_status_t status, pj_size_t *remainder)
Definition: ssl_sock.h:565
pj_qos_type
Definition: sock_qos.h:235
I/O Dispatching Mechanism.
Definition: ssl_sock.h:790
struct pj_ssl_cert_t pj_ssl_cert_t
Definition: ssl_sock.h:60
pj_grp_lock_t * grp_lock
Definition: ssl_sock.h:782
@ PJ_SSL_CERT_EINVALID_PURPOSE
Definition: ssl_sock.h:94
#define pj_SOCK_STREAM()
Definition: sock.h:160
int pj_rand(void)
const char * pj_ssl_curve_name(pj_ssl_curve curve)
#define PJ_EBUG
Definition: errno.h:353
#define PJ_BEGIN_DECL
Definition: config.h:1244
unsigned curves_num
Definition: ssl_sock.h:933
pj_bool_t(* on_connect_complete)(pj_ssl_sock_t *ssock, pj_status_t status)
Definition: ssl_sock.h:669
pj_bool_t(* on_accept_complete)(pj_activesock_t *asock, pj_sock_t newsock, const pj_sockaddr_t *src_addr, int src_addr_len)
Definition: activesock.h:148
const pj_sockaddr_t * localaddr
Definition: ssl_sock.h:1071
Definition: pool.h:310
const pj_sockaddr_t * remaddr
Definition: ssl_sock.h:1083
void * pj_memmove(void *dst, const void *src, pj_size_t size)
Definition: string.h:798
pj_status_t pj_activesock_start_read2(pj_activesock_t *asock, pj_pool_t *pool, unsigned buff_size, void *readbuf[], pj_uint32_t flags)
void pj_sockaddr_t
Definition: types.h:267
@ PJ_SSL_CERT_EINVALID_FORMAT
Definition: ssl_sock.h:89
pj_status_t pj_ssl_sock_send(pj_ssl_sock_t *ssock, pj_ioqueue_op_key_t *send_key, const void *data, pj_ssize_t *size, unsigned flags)
pj_bool_t pj_symbianos_poll(int priority, int ms_timeout)
pj_status_t pj_ssl_sock_start_read(pj_ssl_sock_t *ssock, pj_pool_t *pool, unsigned buff_size, pj_uint32_t flags)
@ PJ_SSL_SOCK_PROTO_TLS1_2
Definition: ssl_sock.h:709
pj_time_val start
Definition: ssl_sock.h:168
pj_timer_heap_t * timer_heap
Definition: ssl_sock.h:828
pj_off_t pj_file_size(const char *filename)
struct pj_ssl_cert_info::@2 subject
void pj_pool_release(pj_pool_t *pool)
pj_bool_t(* on_accept_complete2)(pj_ssl_sock_t *ssock, pj_ssl_sock_t *newsock, const pj_sockaddr_t *src_addr, int src_addr_len, pj_status_t status)
Definition: ssl_sock.h:651
int sock_type
Definition: ssl_sock.h:815
#define pj_AF_INET()
Definition: sock.h:113
pj_status_t pj_ssl_sock_start_recvfrom(pj_ssl_sock_t *ssock, pj_pool_t *pool, unsigned buff_size, pj_uint32_t flags)
pj_status_t pj_ssl_cert_get_verify_status_strings(pj_uint32_t verify_status, const char *error_strings[], unsigned *count)
struct pj_ioqueue_t pj_ioqueue_t
Definition: types.h:210
struct pj_ssl_cert_info::@3 issuer
pj_bool_t gmt
Definition: ssl_sock.h:170
pj_ssl_cipher * ciphers
Definition: ssl_sock.h:924
pj_ssl_cert_name_type type
Definition: ssl_sock.h:177
pj_time_val timeout
Definition: ssl_sock.h:977
void * pj_activesock_get_user_data(pj_activesock_t *asock)
unsigned async_cnt
Definition: ssl_sock.h:860
void * pj_oshandle_t
Definition: types.h:257
int pj_status_t
Definition: types.h:68
pj_bool_t reuse_addr
Definition: ssl_sock.h:1011
pj_qos_type qos_type
Definition: ssl_sock.h:1020
pj_uint32_t proto
Definition: ssl_sock.h:741
long sec
Definition: types.h:382
void * pj_pool_alloc(pj_pool_t *pool, pj_size_t size)
@ PJ_SSL_SOCK_PROTO_SSL23
Definition: ssl_sock.h:715
@ PJ_SSL_SOCK_PROTO_SSL2
Definition: ssl_sock.h:689
pj_sockaddr remote_addr
Definition: ssl_sock.h:757
Definition: ioqueue.h:209
pj_uint32_t verify_status
Definition: ssl_sock.h:772
pj_ssl_cert_verify_flag_t
Definition: ssl_sock.h:63
Definition: ssl_sock.h:146
@ PJ_SSL_CERT_EREVOKED
Definition: ssl_sock.h:111
pj_status_t pj_activesock_create(pj_pool_t *pool, pj_sock_t sock, int sock_type, const pj_activesock_cfg *opt, pj_ioqueue_t *ioqueue, const pj_activesock_cb *cb, void *user_data, pj_activesock_t **p_asock)
Socket Abstraction.
#define PJ_TIME_VAL_SUB(t1, t2)
Definition: types.h:481
pj_qos_params qos_params
Definition: ssl_sock.h:1029
pj_time_val end
Definition: ssl_sock.h:169
void pj_sockaddr_cp(pj_sockaddr_t *dst, const pj_sockaddr_t *src)
Definition: sock.h:616
pj_bool_t(* on_accept_complete)(pj_ssl_sock_t *ssock, pj_ssl_sock_t *newsock, const pj_sockaddr_t *src_addr, int src_addr_len)
Definition: ssl_sock.h:629
#define PJ_UNUSED_ARG(arg)
Definition: config.h:1303
void * pj_ssl_sock_get_user_data(pj_ssl_sock_t *ssock)
@ PJ_SSL_CERT_ECRL_FAILURE
Definition: ssl_sock.h:106
pj_status_t pj_ssl_cert_load_from_buffer(pj_pool_t *pool, const pj_ssl_cert_buffer *CA_buf, const pj_ssl_cert_buffer *cert_buf, const pj_ssl_cert_buffer *privkey_buf, const pj_str_t *privkey_pass, pj_ssl_cert_t **p_cert)
pj_bool_t pj_ssl_curve_is_supported(pj_ssl_curve curve)
struct pj_grp_lock_t pj_grp_lock_t
Definition: types.h:242
pj_bool_t sockopt_ignore_error
Definition: ssl_sock.h:1054
pj_ssl_cipher pj_ssl_cipher_id(const char *cipher_name)
@ PJ_SUCCESS
Definition: types.h:93
unsigned int pj_uint32_t
Definition: types.h:43
pj_bool_t qos_ignore_error
Definition: ssl_sock.h:1037
pj_ssl_cipher cipher
Definition: ssl_sock.h:747
pj_bool_t pj_ssl_cipher_is_supported(pj_ssl_cipher cipher)
void pj_timer_heap_destroy(pj_timer_heap_t *ht)
char * ptr
Definition: types.h:122
pj_ssl_cert_info * local_cert_info
Definition: ssl_sock.h:762
Definition: types.h:119
pj_str_t sigalgs
Definition: ssl_sock.h:949
pj_status_t pj_ssl_sock_sendto(pj_ssl_sock_t *ssock, pj_ioqueue_op_key_t *send_key, const void *data, pj_ssize_t *size, unsigned flags, const pj_sockaddr_t *addr, int addr_len)
pj_ssl_sock_proto
Definition: ssl_sock.h:679
Definition: ssl_sock.h:1062
Definition: types.h:379
pj_status_t pj_ssl_sock_start_read2(pj_ssl_sock_t *ssock, pj_pool_t *pool, unsigned buff_size, void *readbuf[], pj_uint32_t flags)
struct pj_ssl_cert_info::@5::@7 * entry
pj_status_t pj_ssl_sock_renegotiate(pj_ssl_sock_t *ssock)
pj_status_t pj_ssl_sock_set_user_data(pj_ssl_sock_t *ssock, void *user_data)
pj_status_t pj_ssl_curve_get_availables(pj_ssl_curve curves[], unsigned *curve_num)
pj_status_t pj_sockaddr_init(int af, pj_sockaddr *addr, const pj_str_t *cp, pj_uint16_t port)
pj_str_t * pj_strset2(pj_str_t *str, char *src)
Definition: string.h:121
Definition: activesock.h:56
#define PJ_LOG(level, arg)
Definition: log.h:107
pj_ssl_entropy_t entropy_type
Definition: ssl_sock.h:960
pj_ssl_cipher
Definition: ssl_sock.h:314
pj_status_t pj_file_close(pj_oshandle_t fd)
@ PJ_TRUE
Definition: types.h:96
pj_uint16_t local_port_range
Definition: ssl_sock.h:1078
unsigned char pj_uint8_t
Definition: types.h:55
#define PJ_EEOF
Definition: errno.h:393
pj_status_t pj_ssl_sock_create(pj_pool_t *pool, const pj_ssl_sock_param *param, pj_ssl_sock_t **p_ssock)
long pj_sock_t
Definition: types.h:263
void pj_srand(unsigned int seed)
@ PJ_SSL_CERT_EVALIDITY_PERIOD
Definition: ssl_sock.h:83
@ PJ_SSL_CERT_EISSUER_NOT_FOUND
Definition: ssl_sock.h:73
Definition: udp_echo_srv_ioqueue.c:27
#define PJ_ETIMEDOUT
Definition: errno.h:358
pj_sockopt_params sockopt_params
Definition: ssl_sock.h:1045
Definition: sock.h:636
long pj_ssize_t
Definition: types.h:64
@ PJ_SSL_SOCK_PROTO_DEFAULT
Definition: ssl_sock.h:684
pj_ioqueue_t * ioqueue
Definition: ssl_sock.h:821
#define PJ_SSL_SOCK_MAX_CIPHERS
Definition: config.h:1002
pj_status_t pj_ssl_sock_start_accept2(pj_ssl_sock_t *ssock, pj_pool_t *pool, const pj_sockaddr_t *local_addr, int addr_len, const pj_ssl_sock_param *newsock_param)
pj_status_t pj_ioqueue_destroy(pj_ioqueue_t *ioque)
void pj_ssl_cert_wipe_keys(pj_ssl_cert_t *cert)
unsigned long last_native_err
Definition: ssl_sock.h:777
pj_bool_t(* on_data_recvfrom)(pj_ssl_sock_t *ssock, void *data, pj_size_t size, const pj_sockaddr_t *src_addr, int addr_len, pj_status_t status)
Definition: ssl_sock.h:590
unsigned version
Definition: ssl_sock.h:148
pj_status_t pj_ssl_cert_load_from_files2(pj_pool_t *pool, const pj_str_t *CA_file, const pj_str_t *CA_path, const pj_str_t *cert_file, const pj_str_t *privkey_file, const pj_str_t *privkey_pass, pj_ssl_cert_t **p_cert)
int pj_ioqueue_poll(pj_ioqueue_t *ioque, const pj_time_val *timeout)
struct pj_activesock_t pj_activesock_t
Definition: activesock.h:51
#define PJ_EINVAL
Definition: errno.h:333
unsigned ciphers_num
Definition: ssl_sock.h:918
@ PJ_SSL_CERT_EISSUER_MISMATCH
Definition: ssl_sock.h:101
#define PJ_EPENDING
Definition: errno.h:323
Definition: ssl_sock.h:537
@ PJ_SSL_CERT_EUNTRUSTED
Definition: ssl_sock.h:78
#define PJ_ARRAY_SIZE(a)
Definition: types.h:281
pj_bool_t(* on_connect_complete)(pj_activesock_t *asock, pj_status_t status)
Definition: activesock.h:189
@ PJ_SSL_SOCK_PROTO_SSL3
Definition: ssl_sock.h:694
@ PJ_SSL_SOCK_PROTO_TLS1
Definition: ssl_sock.h:699
void * pj_pool_zalloc(pj_pool_t *pool, pj_size_t size)
Definition: pool.h:489
pj_str_t server_name
Definition: ssl_sock.h:1003
pj_bool_t established
Definition: ssl_sock.h:735
pj_status_t pj_sock_socket(int family, int type, int protocol, pj_sock_t *sock)
pj_status_t pj_ssl_sock_start_connect(pj_ssl_sock_t *ssock, pj_pool_t *pool, const pj_sockaddr_t *localaddr, const pj_sockaddr_t *remaddr, int addr_len)
@ PJ_SSL_CERT_ECHAIN_TOO_LONG
Definition: ssl_sock.h:116
pj_str_t cn
Definition: ssl_sock.h:155
pj_ssl_cert_info * remote_cert_info
Definition: ssl_sock.h:767
@ PJ_SSL_CERT_ESUCCESS
Definition: ssl_sock.h:68
const pj_uint16_t PJ_AF_INET
pj_status_t pj_ssl_sock_get_info(pj_ssl_sock_t *ssock, pj_ssl_sock_info *info)
@ PJ_FALSE
Definition: types.h:99
void pj_time_val_normalize(pj_time_val *t)
long msec
Definition: types.h:385
#define PJ_INVALID_SOCKET
Definition: sock.h:485
Definition: ssl_sock.h:729
pj_ssl_curve * curves
Definition: ssl_sock.h:939
pj_ssl_curve
Definition: ssl_sock.h:443
Socket QoS API.
unsigned pj_timer_heap_poll(pj_timer_heap_t *ht, pj_time_val *next_delay)
@ PJ_SSL_SOCK_PROTO_TLS1_1
Definition: ssl_sock.h:704
pj_bool_t require_client_cert
Definition: ssl_sock.h:992
pj_status_t pj_ssl_sock_start_recvfrom2(pj_ssl_sock_t *ssock, pj_pool_t *pool, unsigned buff_size, void *readbuf[], pj_uint32_t flags)
pj_status_t pj_activesock_close(pj_activesock_t *asock)
pj_str_t raw
Definition: ssl_sock.h:184
unsigned short pj_uint16_t
Definition: types.h:49
void * user_data
Definition: ssl_sock.h:838
void pj_ssl_sock_param_default(pj_ssl_sock_param *param)
void pj_ssl_sock_param_copy(pj_pool_t *pool, pj_ssl_sock_param *dst, const pj_ssl_sock_param *src)
pj_ssize_t slen
Definition: types.h:125
char * pj_sockaddr_print(const pj_sockaddr_t *addr, char *buf, int size, unsigned flags)
struct pj_ssl_sock_t pj_ssl_sock_t
Definition: ssl_sock.h:53
Definition: sock_qos.h:274
pj_status_t pj_file_read(pj_oshandle_t fd, void *data, pj_ssize_t *size)
int pj_memcmp(const void *buf1, const void *buf2, pj_size_t size)
Definition: string.h:812
#define PJ_END_DECL
Definition: config.h:1245
@ PJ_O_RDONLY
Definition: file_io.h:61
pj_str_t name
Definition: ssl_sock.h:179
pj_uint8_t serial_no[20]
Definition: ssl_sock.h:150
pj_ssl_sock_cb cb
Definition: ssl_sock.h:833
@ PJ_SSL_CERT_EUNKNOWN
Definition: ssl_sock.h:129
pj_status_t pj_activesock_start_accept(pj_activesock_t *asock, pj_pool_t *pool)
struct pj_timer_heap_t pj_timer_heap_t
Definition: types.h:221
pj_str_t info
Definition: ssl_sock.h:156
pj_ssize_t pj_ssl_cert_info_dump(const pj_ssl_cert_info *ci, const char *indent, char *buf, pj_size_t buf_size)
pj_bool_t verify_peer
Definition: ssl_sock.h:984
pj_status_t pj_ssl_sock_set_certificate(pj_ssl_sock_t *ssock, pj_pool_t *pool, const pj_ssl_cert_t *cert)
pj_status_t pj_ioqueue_create(pj_pool_t *pool, pj_size_t max_fd, pj_ioqueue_t **ioqueue)

 


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.