~ubuntu-branches/ubuntu/precise/openssl098/precise

« back to all changes in this revision

Viewing changes to demos/easy_tls/easy-tls.h

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2011-03-23 19:50:31 UTC
  • Revision ID: james.westby@ubuntu.com-20110323195031-6h9crj4bymhhr8b8
Tags: upstream-0.9.8o
ImportĀ upstreamĀ versionĀ 0.9.8o

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; c-file-style: "bsd" -*- */
 
2
/*
 
3
 * easy-tls.h -- generic TLS proxy.
 
4
 * $Id: easy-tls.h,v 1.1 2001/09/17 19:06:59 bodo Exp $
 
5
 */
 
6
/*
 
7
 * (c) Copyright 1999 Bodo Moeller.  All rights reserved.
 
8
 */
 
9
 
 
10
#ifndef HEADER_TLS_H
 
11
#define HEADER_TLS_H
 
12
 
 
13
#ifndef HEADER_SSL_H
 
14
typedef struct ssl_ctx_st SSL_CTX;
 
15
#endif
 
16
 
 
17
#define TLS_INFO_SIZE 512 /* max. # of bytes written to infofd */
 
18
 
 
19
void tls_set_dhe1024(int i, void* apparg);
 
20
/* Generate DHE parameters:
 
21
 * i >= 0 deterministic (i selects seed), i < 0 random (may take a while).
 
22
 * tls_create_ctx calls this with random non-negative i if the application
 
23
 * has never called it.*/
 
24
 
 
25
void tls_rand_seed(void);
 
26
int tls_rand_seed_from_file(const char *filename, size_t n, void *apparg);
 
27
void tls_rand_seed_from_memory(const void *buf, size_t n);
 
28
 
 
29
struct tls_create_ctx_args 
 
30
{
 
31
    int client_p;
 
32
    const char *certificate_file;
 
33
    const char *key_file;
 
34
    const char *ca_file;
 
35
    int verify_depth;
 
36
    int fail_unless_verified;
 
37
    int export_p;
 
38
};
 
39
struct tls_create_ctx_args tls_create_ctx_defaultargs(void);
 
40
/* struct tls_create_ctx_args is similar to a conventional argument list,
 
41
 * but it can provide default values and allows for future extension. */
 
42
SSL_CTX *tls_create_ctx(struct tls_create_ctx_args, void *apparg);
 
43
 
 
44
struct tls_start_proxy_args
 
45
{
 
46
    int fd;
 
47
    int client_p;
 
48
    SSL_CTX *ctx;
 
49
    pid_t *pid;
 
50
    int *infofd;
 
51
};
 
52
struct tls_start_proxy_args tls_start_proxy_defaultargs(void);
 
53
/* tls_start_proxy return value *MUST* be checked!
 
54
 * 0 means ok, otherwise we've probably run out of some resources. */
 
55
int tls_start_proxy(struct tls_start_proxy_args, void *apparg);
 
56
 
 
57
#endif