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