static void h_header(struct SXE_HTTPD_REQUEST *request, const char *key, unsigned klen, const char *val, unsigned vlen) { SXE * this = sxe_httpd_request_get_sxe(request); SXE_UNUSED_PARAMETER(this); SXEE65I("%s(key=[%.*s],value=[%.*s])", __func__, klen, key, vlen, val); tap_ev_queue_push(q_httpd, __func__, 3, "request", request, "key", tap_dup(key, klen), "value", tap_dup(val, vlen)); SXER60I("return"); }
static void h_request(struct SXE_HTTPD_REQUEST *request, const char *method, unsigned mlen, const char *url, unsigned ulen, const char *version, unsigned vlen) { SXE * this = sxe_httpd_request_get_sxe(request); SXE_UNUSED_PARAMETER(this); SXEE67I("%s(method=[%.*s],url=[%.*s],version=[%.*s])", __func__, mlen, method, ulen, url, vlen, version); tap_ev_queue_push(q_httpd, __func__, 4, "request", request, "url", tap_dup(url, ulen), "method", tap_dup(method, mlen), "version", tap_dup(version, vlen)); SXER60I("return"); }
static void t_openlog(const char * ident, int option, int facility) { tap_ev_queue_push(q_syslog, "openlog", 3, "ident", tap_dup(ident, strlen(ident)), "option", (intptr_t)option, "facility", facility); }
static void test_dirwatch_event(EV_P_ const char *chfile, int chflags, void * user_data) { SXE_UNUSED_PARAMETER(loop); SXEE6("test_dirwatch_event(chfile=%s, chflags=%08x, user_data=%p)", chfile, chflags, user_data); tap_ev_push(__func__, 3, "chfile", tap_dup(chfile, strlen(chfile)), "chflags", chflags, "user_data", user_data); SXER6("return"); }
static void h_body(struct SXE_HTTPD_REQUEST *request, const char *buf, unsigned used) { SXE * this = sxe_httpd_request_get_sxe(request); SXE_UNUSED_PARAMETER(this); SXEE63I("%s(buf=%p,used=%u)", __func__, buf, used); tap_ev_queue_push(q_httpd, __func__, 4, "request", request, "buf", tap_dup(buf, used), "used", used); SXER60I("return"); }
static void t_syslog(int priority, const char * format, ...) { va_list ap; const char *logline; assert(strcmp(format, "%s") == 0); va_start(ap, format); logline = va_arg(ap, const char *); tap_ev_queue_push(q_syslog, "syslog", 2, "priority", priority, "logline", tap_dup(logline, strlen(logline))); va_end(ap); }
#include "mock.h" #include "sxe.h" #include "sxe-socket.h" #include "sxe-test.h" #include "sxe-util.h" #include "tap.h" #define TEST_WAIT 5.0 static void test_event_read(SXE * this, int length) { SXEE6I("%s(length=%d)", __func__, length); tap_ev_push(__func__, 4, "this", this, "length", length, "buf", tap_dup(SXE_BUF(this), SXE_BUF_USED(this)), "used", SXE_BUF_USED(this)); SXER6("return"); } #define SXE_CAST_SSIZE_T_TO_LONG(_x) ((long)(_x)) static MOCK_SSIZE_T SXE_STDCALL test_mock_recvfrom(MOCK_SOCKET s, MOCK_SOCKET_VOID *buf, MOCK_SOCKET_SSIZE_T len, int flags, struct sockaddr *from, MOCK_SOCKLEN_T *fromlen) { SXE_UNUSED_PARAMETER(s); SXE_UNUSED_PARAMETER(buf); SXE_UNUSED_PARAMETER(len); SXE_UNUSED_PARAMETER(flags); SXE_UNUSED_PARAMETER(from); SXE_UNUSED_PARAMETER(fromlen);