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