Ruby 1.9.2p136(2010-12-25revision30365)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Defines | Functions | Variables

# ext/openssl/ossl_ssl_session.c File Reference

`#include "ossl.h"`
Include dependency graph for ossl_ssl_session.c:

Go to the source code of this file.

## Defines
#define | GetSSLSession(obj, sess)
#define | SafeGetSSLSession(obj, sess)
#define | SSLSESSION_SET_TIME(func)
## Functions
static VALUE | ossl_ssl_session_alloc (VALUE klass)
static VALUE | ossl_ssl_session_initialize (VALUE self, VALUE arg1)
int | SSL_SESSION_cmp (const SSL_SESSION *a, const SSL_SESSION *b)
static VALUE | ossl_ssl_session_eq (VALUE val1, VALUE val2)
static VALUE | ossl_ssl_session_get_time (VALUE self)
static VALUE | ossl_ssl_session_get_timeout (VALUE self)
static VALUE | ossl_ssl_session_to_der (VALUE self)
static VALUE | ossl_ssl_session_to_pem (VALUE self)
static VALUE | ossl_ssl_session_to_text (VALUE self)
void | Init_ossl_ssl_session (void)
## Variables
VALUE | cSSLSession
static VALUE | eSSLSession

## Define Documentation

#define GetSSLSession | ( |  | obj,
|  |  | sess
| ) |  |

Value:

    do { \
            Data_Get_Struct(obj, SSL_SESSION, sess); \
            if (!sess) { \
                    ossl_raise(rb_eRuntimeError, "SSL Session wasn't initialized."); \
            } \
    } while (0)

Definition at line 7 of file ossl_ssl_session.c.

Referenced by ossl_ssl_session_eq(), ossl_ssl_session_get_time(), ossl_ssl_session_get_timeout(), ossl_ssl_session_to_der(), ossl_ssl_session_to_pem(), and ossl_ssl_session_to_text().

#define SafeGetSSLSession | ( |  | obj,
|  |  | sess
| ) |  |

Value:

    do { \
            OSSL_Check_Kind(obj, cSSLSession); \
            GetSSLSession(obj, sess); \
    } while (0)

Definition at line 14 of file ossl_ssl_session.c.

Referenced by ossl_ssl_session_eq().

#define SSLSESSION_SET_TIME | ( |  | func | ) |

Value:

    static VALUE ossl_ssl_session_set_##func(VALUE self, VALUE time_v)      \
            {                                                                       \
                    SSL_SESSION *ctx;                                               \
                    unsigned long t;                                                \
                                                                                    \
                    GetSSLSession(self, ctx);                                       \
                                                                                    \
                    if (rb_obj_is_instance_of(time_v, rb_cTime)) {                  \
                            time_v = rb_funcall(time_v, rb_intern("to_i"), 0);      \
                    } else if (FIXNUM_P(time_v)) {                                  \
                            ;                                                       \
                    } else {                                                        \
                            rb_raise(rb_eArgError, "unknown type");                 \
                    }                                                               \
                                                                                    \
                    t = NUM2ULONG(time_v);                                          \
                                                                                    \
                    SSL_SESSION_set_##func(ctx, t);                                 \
                                                                                    \
                    return ossl_ssl_session_get_##func(self);                       \
            }

Definition at line 142 of file ossl_ssl_session.c.

## Function Documentation

void Init_ossl_ssl_session | ( | void |  | ) |

Definition at line 279 of file ossl_ssl_session.c.

References cSSLSession, eOSSLError, eSSLSession, mOSSL, mSSL, ossl_ssl_session_alloc(), ossl_ssl_session_eq(), ossl_ssl_session_get_time(), ossl_ssl_session_get_timeout(), ossl_ssl_session_initialize(), ossl_ssl_session_to_der(), ossl_ssl_session_to_pem(), ossl_ssl_session_to_text(), rb_cObject, rb_define_alloc_func(), rb_define_class_under(), rb_define_method(), rb_define_module(), rb_define_module_under(), and rb_undef_method().

Referenced by Init_ossl_ssl().

static VALUE ossl_ssl_session_alloc | ( | VALUE | klass | ) | `[static]`

Definition at line 23 of file ossl_ssl_session.c.

References Data_Wrap_Struct, and NULL.

Referenced by Init_ossl_ssl_session().

static VALUE ossl_ssl_session_eq | ( | VALUE | val1,
|  | VALUE | val2
| ) |  | `[static]`

Definition at line 90 of file ossl_ssl_session.c.

References GetSSLSession, Qfalse, Qtrue, SafeGetSSLSession, and SSL_SESSION_cmp().

Referenced by Init_ossl_ssl_session().

static VALUE ossl_ssl_session_get_time | ( | VALUE | self | ) | `[static]`

Definition at line 108 of file ossl_ssl_session.c.

References GetSSLSession, Qnil, rb_cTime, rb_funcall(), rb_intern, and time_t.

Referenced by Init_ossl_ssl_session().

static VALUE ossl_ssl_session_get_timeout | ( | VALUE | self | ) | `[static]`

Definition at line 130 of file ossl_ssl_session.c.

References GetSSLSession, and time_t.

Referenced by Init_ossl_ssl_session().

static VALUE ossl_ssl_session_initialize | ( | VALUE | self,
|  | VALUE | arg1
| ) |  | `[static]`

Definition at line 36 of file ossl_ssl_session.c.

References cSSLSocket, Data_Get_Struct, eSSLSession, NULL, ossl_obj2bio(), ossl_raise(), rb_eArgError, rb_obj_is_instance_of(), and RDATA.

Referenced by Init_ossl_ssl_session().

static VALUE ossl_ssl_session_to_der | ( | VALUE | self | ) | `[static]`

Definition at line 195 of file ossl_ssl_session.c.

References buf, eSSLSession, GetSSLSession, len, ossl_raise(), and rb_str_new().

Referenced by Init_ossl_ssl_session().

static VALUE ossl_ssl_session_to_pem | ( | VALUE | self | ) | `[static]`

Definition at line 220 of file ossl_ssl_session.c.

References buf, eSSLSession, GetSSLSession, ossl_raise(), and rb_str_new().

Referenced by Init_ossl_ssl_session().

static VALUE ossl_ssl_session_to_text | ( | VALUE | self | ) | `[static]`

Definition at line 253 of file ossl_ssl_session.c.

References buf, eSSLSession, GetSSLSession, ossl_raise(), and rb_str_new().

Referenced by Init_ossl_ssl_session().

int SSL_SESSION_cmp | ( | const SSL_SESSION * | a,
|  | const SSL_SESSION * | b
| ) |  |

Definition at line 76 of file ossl_ssl_session.c.

References memcmp().

Referenced by ossl_ssl_session_eq().

## Variable Documentation

VALUE cSSLSession

Definition at line 20 of file ossl_ssl_session.c.

Referenced by Init_ossl_ssl_session(), ossl_sslctx_session_get_cb(), ossl_sslctx_session_new_cb(), and ossl_sslctx_session_remove_cb().

VALUE eSSLSession`[static]`

Definition at line 21 of file ossl_ssl_session.c.

Referenced by Init_ossl_ssl_session(), ossl_ssl_session_initialize(), ossl_ssl_session_to_der(), ossl_ssl_session_to_pem(), and ossl_ssl_session_to_text().