plugins/httprc_xajax/httprc_xajax.c File Reference

#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <time.h>
#include <stdarg.h>
#include <stdlib.h>
#include <ekg/debug.h>
#include <ekg/dynstuff.h>
#include <ekg/log.h>
#include <ekg/plugins.h>
#include <ekg/strings.h>
#include <ekg/stuff.h>
#include <ekg/userlist.h>
#include <ekg/vars.h>
#include <ekg/windows.h>
#include <ekg/xmalloc.h>

Data Structures

struct  ncurses_window_t
struct  client_t

Defines

#define LOCALHOST   "localhost"
#define HTTPRCXAJAX_DEFPORT   "8080"
#define ISBOLD   (att & FSTR_BOLD)
#define ISBLINK   (att & FSTR_BLINK)
#define ISUNDERLINE   (att & FSTR_UNDERLINE)
#define ISREVERSE   (att & FSTR_REVERSE)
#define ISNORMAL   (att & FSTR_NORMAL)
#define ISONLYNORMAL   ((att & FSTR_NORMAL) && !(att & (FSTR_BOLD|FSTR_BLINK|FSTR_REVERSE|FSTR_UNDERLINE)))
#define FORE   (att & FSTR_FOREMASK)
#define BACK   ((att & FSTR_BACKMASK)>>3)
#define ADDJS(x)   string_append(asc, x)
#define ADDJSf(x...)   string_append_format(asc, x)
#define httprc_write(watch, args...)   string_append_format(watch->buf, args)
#define httprc_write2(watch, str)   string_append_n(watch->buf, str, -1)
#define httprc_write3(watch, str, len)   string_append_raw(watch->buf, str, len)
#define HTTP_HEADER(ver, scode, eheaders)
#define WATCH_FIND(w, fd)

Enumerations

enum  http_method_t {
  HTTP_METHOD_UNKNOWN = -1, HTTP_METHOD_OPTIONS = 0, HTTP_METHOD_GET, HTTP_METHOD_HEAD,
  HTTP_METHOD_POST, HTTP_METHOD_PUT, HTTP_METHOD_DELETE, HTTP_METHOD_TRACE,
  HTTP_METHOD_CONNECT
}

Functions

 PLUGIN_DEFINE (httprc_xajax, PLUGIN_UI, NULL)
client_tfind_client_by_cookie (list_t clients, char *cookie)
char * generate_cookie (void)
char * escape_single_quote (char *p, int inuni)
char * http_fstring (int winid, char *parent, fstring_t *line, int inuni)
int http_watch_send (int type, int fd, const char *watch, void *data)
int httprc_xajax_def_action (void *data, va_list ap)
const char * http_timestamp (time_t t)
int http_watch_read (int type, int fd, watch_type_t watch, void *data)
int http_watch_accept (int type, int fd, watch_type_t watch, void *data)
int httprc_xajax_plugin_init (int prio)
static int httprc_xajax_plugin_destroy ()

Variables

list_t clients = NULL

Define Documentation

#define ADDJS (  )     string_append(asc, x)

#define ADDJSf ( x...   )     string_append_format(asc, x)

#define BACK   ((att & FSTR_BACKMASK)>>3)

#define FORE   (att & FSTR_FOREMASK)

#define HTTP_HEADER ( ver,
scode,
eheaders   ) 

Value:

httprc_write(send_watch,                                \
                "%s %d %s\r\n"                                          /* statusline: $PROTOCOL $SCODE $RESPONSE */\
                "Server: ekg2-CVS-httprc_xajax plugin\r\n"              /* server info */       \
                "%s\r\n",                                                       /* headers */           \
                ver == 0 ? "HTTP/1.0" : ver == 1 ? "HTTP/1.1" : "",     /* PROTOCOL */          \
                scode,                                                  /* Status code */       \
                        /* some typical responses */            \
                        scode == 100 ? "Continue" :             \
                        scode == 101 ? "Switching Protocols" :  \
                        scode == 200 ? "OK" :                   \
                        scode == 302 ? "Found" :                \
                        "",                                     \
                eheaders ? eheaders : "\r\n"                    \
                ); clen = (send_watch->buf ? send_watch->buf->len : 0) - clen;

#define httprc_write ( watch,
args...   )     string_append_format(watch->buf, args)

#define httprc_write2 ( watch,
str   )     string_append_n(watch->buf, str, -1)

#define httprc_write3 ( watch,
str,
len   )     string_append_raw(watch->buf, str, len)

#define HTTPRCXAJAX_DEFPORT   "8080"

#define ISBLINK   (att & FSTR_BLINK)

#define ISBOLD   (att & FSTR_BOLD)

#define ISNORMAL   (att & FSTR_NORMAL)

#define ISONLYNORMAL   ((att & FSTR_NORMAL) && !(att & (FSTR_BOLD|FSTR_BLINK|FSTR_REVERSE|FSTR_UNDERLINE)))

#define ISREVERSE   (att & FSTR_REVERSE)

#define ISUNDERLINE   (att & FSTR_UNDERLINE)

#define LOCALHOST   "localhost"

#define WATCH_FIND ( w,
fd   ) 

Value:

w = watch_find(&httprc_xajax_plugin, fd, WATCH_WRITE);\
        if (!w) w = watch_add_line(&httprc_xajax_plugin, fd, WATCH_WRITE_LINE, http_watch_send, NULL); \


Enumeration Type Documentation

enum http_method_t

Enumerator:
HTTP_METHOD_UNKNOWN 
HTTP_METHOD_OPTIONS 
HTTP_METHOD_GET 
HTTP_METHOD_HEAD 
HTTP_METHOD_POST 
HTTP_METHOD_PUT 
HTTP_METHOD_DELETE 
HTTP_METHOD_TRACE 
HTTP_METHOD_CONNECT 


Function Documentation

char* escape_single_quote ( char *  p,
int  inuni 
)

client_t* find_client_by_cookie ( list_t  clients,
char *  cookie 
)

char* generate_cookie ( void   ) 

char* http_fstring ( int  winid,
char *  parent,
fstring_t line,
int  inuni 
)

const char* http_timestamp ( time_t  t  ) 

int http_watch_accept ( int  type,
int  fd,
watch_type_t  watch,
void *  data 
)

int http_watch_read ( int  type,
int  fd,
watch_type_t  watch,
void *  data 
)

int http_watch_send ( int  type,
int  fd,
const char *  watch,
void *  data 
)

int httprc_xajax_def_action ( void *  data,
va_list  ap 
)

static int httprc_xajax_plugin_destroy (  )  [static]

int httprc_xajax_plugin_init ( int  prio  ) 

PLUGIN_DEFINE ( httprc_xajax  ,
PLUGIN_UI  ,
NULL   
)


Variable Documentation

list_t clients = NULL


Generated on Mon Jan 5 22:30:53 2009 for ekg2 by  doxygen 1.5.1