Sha256: fde043779f6560137ec20030582272b1c67feb05a6be3015dc3592e238b46296

Contents?: true

Size: 1.88 KB

Versions: 3

Compression:

Stored size: 1.88 KB

Contents

#pragma once
#include <ruby.h>
#include <ruby/encoding.h>
#include <stdbool.h>
#include <http_parser.h>
#include "inc/status_codes.h"

#ifdef DEBUG
#undef NDEBUG
#endif

#define nyara_inspect(value) do {\
    volatile VALUE _xx = rb_inspect(value);\
    printf("%s: %.*s\n", __func__, (int)RSTRING_LEN(_xx), RSTRING_PTR(_xx));\
  } while(0)


/* event.c */
void Init_event(VALUE ext);
void nyara_detach_rid(VALUE rid);


/* request_parse.c */
void Init_request_parse(VALUE nyara, VALUE ext);


/* request.c */
void Init_request(VALUE nyara, VALUE ext);
void nyara_request_term_close(VALUE request);
bool nyara_send_data(int fd, const char* s, long len);


/* test_response.c */
void Init_test_response(VALUE nyara);


/* url_encoded.c */
void Init_url_encoded(VALUE ext);
long nyara_parse_path(VALUE path, const char*s, long len);
void nyara_decode_uri_kv(volatile VALUE key, volatile VALUE value, const char* kv_s, long kv_len);


/* accept.c */
void Init_accept(VALUE ext);
VALUE ext_parse_accept_value(VALUE _, VALUE str);


/* mime.c */
void Init_mime(VALUE ext);
VALUE ext_mime_match(VALUE _, VALUE request_accept, VALUE accept_mimes);


/* hashes.c */
void Init_hashes(VALUE nyara);
void nyara_parse_query(VALUE output, const char* s, long len);


// "ab-cd" => "Ab-Cd"
// note str must be string created by nyara code
void nyara_headerlize(VALUE str);
// int nyara_rb_hash_has_key(VALUE hash, VALUE key);

extern VALUE nyara_param_hash_class;
extern VALUE nyara_header_hash_class;
extern VALUE nyara_config_hash_class;


/* route.c */
typedef struct {
  VALUE controller;
  VALUE args;
  VALUE scope;
  VALUE format; // string, path extension or matched ext in config
} RouteResult;

extern void Init_route(VALUE nyara, VALUE ext);
extern RouteResult nyara_lookup_route(enum http_method method_num, VALUE vpath, VALUE accept_arr);


/* nyara.c */
void nyara_set_nonblock(int fd);
extern rb_encoding* u8_encoding;

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nyara-0.1.pre.2 ext/nyara.h
nyara-0.1.pre.1 ext/nyara.h
nyara-0.1.pre.0 ext/nyara.h