Skip to content

Commit

Permalink
Set handler for the client hello message
Browse files Browse the repository at this point in the history
  • Loading branch information
pquerna committed Jun 3, 2011
1 parent a9e961e commit db26067
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion include/selene.h
Expand Up @@ -72,7 +72,9 @@ typedef enum {
/* The first bytes of our TLS data looked like an HTTP request, maybe send
* your client a nice error message? */
SELENE_EVENT_TLS_GOT_HTTP = 7,
SELENE_EVENT__MAX = 8,
/* INTERNAL: When we recieved a properly formed client hello */
SELENE__EVENT_HS_GOT_CLIENT_HELLO = 8,
SELENE_EVENT__MAX = 9,
} selene_event_e;

typedef enum {
Expand Down
8 changes: 8 additions & 0 deletions lib/backends/native/handshake_io.c
Expand Up @@ -174,7 +174,15 @@ sln_native_io_handshake_read(selene_t *s, sln_native_baton_t *baton)

if (hs.current_msg_baton != NULL && hs.current_msg_destroy != NULL) {
hs.current_msg_destroy(&hs, hs.current_msg_baton);
selene_publish(s, SELENE__EVENT_HS_GOT_CLIENT_HELLO);
}

return SELENE_SUCCESS;
}

selene_error_t*
sln_handshake_handle_client_hello(selene_t *ctxt, selene_event_e event, void *baton_)
{
/* TODO: fetch current message, */
return SELENE_SUCCESS;
}
4 changes: 4 additions & 0 deletions lib/backends/native/handshake_messages.h
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

#include "sln_tok.h"

#ifndef _handshake_messages_h_
#define _handshake_messages_h_

Expand Down Expand Up @@ -115,5 +117,7 @@ sln_handshake_parse_client_hello_step(sln_hs_baton_t *hs, sln_tok_value_t *v, vo
void
sln_handshake_parse_client_hello_destroy(sln_hs_baton_t *hs, void *baton);

selene_error_t* sln_handshake_handle_client_hello(selene_t *ctxt, selene_event_e event, void *baton_);

#endif

4 changes: 3 additions & 1 deletion lib/backends/native/init.c
Expand Up @@ -17,7 +17,7 @@

#include "sln_brigades.h"
#include "native.h"

#include "handshake_messages.h"

selene_error_t*
sln_native_initilize()
Expand All @@ -43,6 +43,8 @@ sln_native_create(selene_t *s)
sln_brigade_create(s->alloc, &baton->in_handshake);
sln_brigade_create(s->alloc, &baton->in_application);

selene_handler_set(s, SELENE__EVENT_HS_GOT_CLIENT_HELLO, sln_handshake_handle_client_hello, NULL);

return SELENE_SUCCESS;
}

Expand Down

0 comments on commit db26067

Please sign in to comment.