Skip to content

Commit

Permalink
added themis cmd type and reuqest type
Browse files Browse the repository at this point in the history
  • Loading branch information
yzprofile committed Nov 23, 2012
1 parent 2e4620e commit 62662b6
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 5 deletions.
13 changes: 11 additions & 2 deletions core/ngx_http_themis_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ ngx_http_themis_init_process(ngx_cycle_t *cycle)

if (ngx_add_channel_event(cycle,
ngx_themis_socketpairs[ngx_process_slot][1], NGX_READ_EVENT,
ngx_themis_channel_read_handler) == NGX_ERROR)
ngx_themis_channel_handler) == NGX_ERROR)
{
return NGX_ERROR;
}
Expand Down Expand Up @@ -375,6 +375,12 @@ ngx_themis_conf_set_config(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_http_themis_main_conf_t *tmcf;

value = cf->args->elts;
if (ngx_strncasecmp(value[1].data, (u_char *) "themis", value[1].len)
== 0)
{
return "\"themis\" is not allowed be a parameter";
}

tlcf->name = value[1];
tlcf->enable = 1;
http_ctx = cf->ctx;
Expand Down Expand Up @@ -542,7 +548,10 @@ ngx_http_themis_interface(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
static ngx_int_t
ngx_http_themis_interface_handler(ngx_http_request_t *r)
{
/* uri: app/module/command */
/*
uri: app/module/command
themis/...
*/

return NGX_DONE;
}
6 changes: 5 additions & 1 deletion core/ngx_themis.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
#include <ngx_themis_channel.h>


#define NGX_THEMIS_MODULE 0x53494d54 /* TMIS */
#define NGX_THEMIS_MODULE 0x53494d54 /* TMIS */

#define NGX_THEMIS_CONF NGX_ANY_CONF

#define NGX_THEMIS_COMMAND 0
#define NGX_THEMIS_REQUEST 1


typedef void *(*ngx_themis_create_config_pt)(ngx_conf_t *cf);
typedef ngx_int_t (*ngx_themis_update_config)(ngx_cycle_t *cycle, void *config);
Expand Down
2 changes: 1 addition & 1 deletion core/ngx_themis_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ngx_socket_t ngx_themis_socketpairs[NGX_MAX_PROCESSES][2];


void
ngx_themis_channel_read_handler(ngx_event_t *ev)
ngx_themis_channel_handler(ngx_event_t *ev)
{

}
6 changes: 5 additions & 1 deletion core/ngx_themis_channel.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef _NGX_THEMIS_CHANNEL_H_INCLUDE_
#define _NGX_THEMIS_CHANNEL_H_INCLUDE_

void ngx_themis_channel_read_handler(ngx_event_t *ev);

#define THEMIS_CHANNEL_TYPE_CONF 0


void ngx_themis_channel_handler(ngx_event_t *ev);

#endif
16 changes: 16 additions & 0 deletions modules/access_mate/ngx_themis_access_mate_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ static ngx_int_t ngx_themis_access_mate_apply_config(ngx_http_request_t *r,
void *config);
static char *ngx_themis_access_add(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static char *ngx_themis_access_status(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);


typedef struct {
Expand Down Expand Up @@ -50,7 +52,14 @@ static ngx_command_t ngx_themis_access_commands[] = {
{ ngx_string("add"),
NGX_THEMIS_CONF|NGX_CONF_TAKE2,
ngx_themis_access_add,
NGX_THEMIS_COMMAND,
0,
NULL },

{ ngx_string("status"),
NGX_THEMIS_CONF|NGX_CONF_TAKE2,
ngx_themis_access_status,
NGX_THEMIS_REQUEST,
0,
NULL },

Expand Down Expand Up @@ -99,6 +108,13 @@ ngx_themis_access_add(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}


static char *
ngx_themis_access_status(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
return NGX_CONF_OK;
}



static ngx_int_t
ngx_themis_access_mate_update_config(ngx_cycle_t *cycle, void *config)
Expand Down

0 comments on commit 62662b6

Please sign in to comment.