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