File: ssl.h

package info (click to toggle)
ctrlproxy 3.0.7-1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 1,668 kB
  • ctags: 2,045
  • sloc: ansic: 15,358; sh: 2,805; xml: 1,078; python: 346; makefile: 302; perl: 18
file content (55 lines) | stat: -rw-r--r-- 1,328 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
 * Copyright (C) 2000-2003, Ximian, Inc.
 */

#ifndef SSL_H
#define SSL_H 1

/**
 * @file
 * @brief SSL
 */

#include <glib.h>

/**
 * SSLType:
 * @SSL_TYPE_CLIENT: the client side of an SSL connection
 * @SSL_TYPE_SERVER: the server side of an SSL connection
 *
 * What kind of SSL connection this is.
 **/
typedef enum {
	SSL_TYPE_CLIENT = 0,
	SSL_TYPE_SERVER
} SSLType;

gpointer    ssl_get_client_credentials  (const char  *ca_file);
void        ssl_free_client_credentials (gpointer     creds);
gpointer    ssl_get_server_credentials  (const char  *cert_file,
					      const char  *key_file);
void        ssl_free_server_credentials (gpointer     creds);

GIOChannel *ssl_wrap_iochannel          (GIOChannel  *sock,
					      SSLType  type,
					      const char  *remote_host,
					      gpointer     credentials);

#define SSL_ERROR ssl_error_quark()

GQuark ssl_error_quark (void);

typedef enum {
	SSL_ERROR_HANDSHAKE_NEEDS_READ,
	SSL_ERROR_HANDSHAKE_NEEDS_WRITE,
	SSL_ERROR_CERTIFICATE,
} SocketError;

void ssl_cert_generate(const char *keyfile, const char *certfile,
		       const char *cafile);

gpointer ssl_create_server_credentials(struct ctrlproxy_config *cfg, 
									   GKeyFile *kf, const char *group);

#endif /* SSL_H */