00001 #pragma once
00002 #ifndef SEAP_H
00003 #define SEAP_H
00004
00005 #include <stdint.h>
00006 #include <seap-debug.h>
00007 #include <sexp.h>
00008 #include <seap-types.h>
00009 #include <seap-message.h>
00010 #include <seap-command.h>
00011 #include <seap-error.h>
00012
00013 SEAP_CTX_t *SEAP_CTX_new (void);
00014 void SEAP_CTX_init (SEAP_CTX_t *ctx);
00015 void SEAP_CTX_free (SEAP_CTX_t *ctx);
00016
00017 int SEAP_connect (SEAP_CTX_t *ctx, const char *uri, uint32_t flags);
00018 int SEAP_listen (SEAP_CTX_t *ctx, int sd, uint32_t maxcli);
00019 int SEAP_accept (SEAP_CTX_t *ctx, int sd);
00020
00021 int SEAP_open (SEAP_CTX_t *ctx, const char *path, uint32_t flags);
00022 SEXP_t *SEAP_read (SEAP_CTX_t *ctx, int sd);
00023 int SEAP_write (SEAP_CTX_t *ctx, int sd, SEXP_t *sexp);
00024 int SEAP_close (SEAP_CTX_t *ctx, int sd);
00025
00026 int SEAP_openfd (SEAP_CTX_t *ctx, int fd, uint32_t flags);
00027 int SEAP_openfd2 (SEAP_CTX_t *ctx, int ifd, int ofd, uint32_t flags);
00028
00029 #if 0
00030 # include <stdio.h>
00031 int SEAP_openfp (SEAP_CTX_t *ctx, FILE *fp, uint32_t flags);
00032 #endif
00033
00034 SEAP_msg_t *SEAP_msg_new (void);
00035 void SEAP_msg_free (SEAP_msg_t *msg);
00036 int SEAP_msg_set (SEAP_msg_t *msg, SEXP_t *sexp);
00037 SEXP_t *SEAP_msg_get (SEAP_msg_t *msg);
00038
00039 int SEAP_msgattr_set (SEAP_msg_t *msg, const char *attr, SEXP_t *value);
00040 SEXP_t *SEAP_msgattr_get (SEAP_msg_t *msg, const char *name);
00041
00042 int SEAP_recvsexp (SEAP_CTX_t *ctx, int sd, SEXP_t **sexp);
00043 int SEAP_recvmsg (SEAP_CTX_t *ctx, int sd, SEAP_msg_t **seap_msg);
00044
00045 int SEAP_sendsexp (SEAP_CTX_t *ctx, int sd, SEXP_t *sexp);
00046 int SEAP_sendmsg (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *seap_msg);
00047
00048 int SEAP_reply (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *rep_msg, SEAP_msg_t *req_msg);
00049
00050 int SEAP_senderr (SEAP_CTX_t *ctx, int sd, SEAP_err_t *err);
00051 int SEAP_recverr (SEAP_CTX_t *ctx, int sd, SEAP_err_t **err);
00052 int SEAP_recverr_byid (SEAP_CTX_t *ctx, int sd, SEAP_err_t **err, SEAP_msgid_t id);
00053
00054 int SEAP_replyerr (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *rep_msg, uint32_t e);
00055
00056 #endif