00001 #pragma once
00002 #ifndef _SEAP_SCHEME_H
00003 #define _SEAP_SCHEME_H
00004
00005 #include <stddef.h>
00006 #include <stdint.h>
00007 #include <unistd.h>
00008 #include "_sexp-types.h"
00009 #include "_seap-types.h"
00010 #include "seap-descriptor.h"
00011 #include "generic/common.h"
00012
00013 typedef struct {
00014 const char *schstr;
00015 int (*sch_connect) (SEAP_desc_t *, const char *, uint32_t);
00016 int (*sch_openfd) (SEAP_desc_t *, int, uint32_t);
00017 int (*sch_openfd2) (SEAP_desc_t *, int, int, uint32_t);
00018 ssize_t (*sch_recv) (SEAP_desc_t *, void *, size_t, uint32_t);
00019 ssize_t (*sch_send) (SEAP_desc_t *, void *, size_t, uint32_t);
00020 int (*sch_close) (SEAP_desc_t *, uint32_t);
00021 ssize_t (*sch_sendsexp) (SEAP_desc_t *, SEXP_t *, uint32_t);
00022 int (*sch_select) (SEAP_desc_t *, int, uint16_t, uint32_t);
00023 } SEAP_schemefn_t;
00024
00025 extern const SEAP_schemefn_t __schtbl[];
00026
00027 #define SCH_CONNECT(idx, ...) __schtbl[idx].sch_connect (__VA_ARGS__)
00028 #define SCH_OPENFD(idx, ...) __schtbl[idx].sch_openfd (__VA_ARGS__)
00029 #define SCH_OPENFD2(idx, ...) __schtbl[idx].sch_openfd2 (__VA_ARGS__)
00030 #define SCH_RECV(idx, ...) __schtbl[idx].sch_recv (__VA_ARGS__)
00031 #define SCH_SEND(idx, ...) __schtbl[idx].sch_send (__VA_ARGS__)
00032 #define SCH_CLOSE(idx, ...) __schtbl[idx].sch_close (__VA_ARGS__)
00033 #define SCH_SENDSEXP(idx, ...) __schtbl[idx].sch_sendsexp (__VA_ARGS__)
00034 #define SCH_SELECT(idx, ...) __schtbl[idx].sch_select (__VA_ARGS__)
00035
00036 #define SEAP_IO_EVREAD 0x01
00037 #define SEAP_IO_EVWRITE 0x02
00038 #define SEAP_IO_EVANY 0x08
00039
00040 #define SEAP_RECVBUF_SIZE 4096
00041 #define SEAP_SENDBUF_SIZE 4096
00042
00043 SEAP_scheme_t SEAP_scheme_search (const SEAP_schemefn_t fntable[], const char *sch, size_t schlen);
00044
00045
00046 #include "sch_cons.h"
00047 #define SCH_CONS 0
00048
00049
00050 #include "sch_dummy.h"
00051 #define SCH_DUMMY 1
00052
00053
00054 #include "sch_generic.h"
00055 #define SCH_GENERIC 2
00056
00057
00058 #include "sch_pipe.h"
00059 #define SCH_PIPE 3
00060
00061 #define SCH_NONE 255
00062
00063 #endif