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 #if 0
00068 # include <stdio.h>
00069 int SEAP_openfp (SEAP_CTX_t *ctx, FILE *fp, uint32_t flags);
00070 #endif
00071
00072 SEAP_msg_t *SEAP_msg_new (void);
00073 void SEAP_msg_free (SEAP_msg_t *msg);
00074 int SEAP_msg_set (SEAP_msg_t *msg, SEXP_t *sexp);
00075 SEXP_t *SEAP_msg_get (SEAP_msg_t *msg);
00076
00077 int SEAP_msgattr_set (SEAP_msg_t *msg, const char *attr, SEXP_t *value);
00078 SEXP_t *SEAP_msgattr_get (SEAP_msg_t *msg, const char *name);
00079
00080 int SEAP_recvsexp (SEAP_CTX_t *ctx, int sd, SEXP_t **sexp);
00081 int SEAP_recvmsg (SEAP_CTX_t *ctx, int sd, SEAP_msg_t **seap_msg);
00082
00083 int SEAP_sendsexp (SEAP_CTX_t *ctx, int sd, SEXP_t *sexp);
00084 int SEAP_sendmsg (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *seap_msg);
00085
00086 int SEAP_reply (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *rep_msg, SEAP_msg_t *req_msg);
00087
00088 int SEAP_senderr (SEAP_CTX_t *ctx, int sd, SEAP_err_t *err);
00089 int SEAP_recverr (SEAP_CTX_t *ctx, int sd, SEAP_err_t **err);
00090 int SEAP_recverr_byid (SEAP_CTX_t *ctx, int sd, SEAP_err_t **err, SEAP_msgid_t id);
00091
00092 int SEAP_replyerr (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *rep_msg, uint32_t e);
00093
00094 #ifdef __cplusplus
00095 }
00096 #endif
00097
00098 #endif