Open SCAP Library

seap.h

00001 /*
00002  * Copyright 2009 Red Hat Inc., Durham, North Carolina.
00003  * All Rights Reserved.
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  *
00019  * Authors:
00020  *      "Daniel Kopecek" <dkopecek@redhat.com>
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 <sexp.h>
00037 #include <seap-types.h>
00038 #include <seap-message.h>
00039 #include <seap-command.h>
00040 #include <seap-error.h>
00041 
00042 #ifndef EOPNOTSUPP
00043 # define EOPNOTSUPP 1001
00044 #endif
00045 
00046 #ifndef ECANCELED
00047 # define ECANCELED  1002
00048 #endif
00049 
00050 SEAP_CTX_t *SEAP_CTX_new  (void);
00051 void        SEAP_CTX_init (SEAP_CTX_t *ctx);
00052 void        SEAP_CTX_free (SEAP_CTX_t *ctx);
00053 
00054 int     SEAP_connect (SEAP_CTX_t *ctx, const char *uri, uint32_t flags);
00055 int     SEAP_listen (SEAP_CTX_t *ctx, int sd, uint32_t maxcli);
00056 int     SEAP_accept (SEAP_CTX_t *ctx, int sd);
00057 
00058 int     SEAP_open  (SEAP_CTX_t *ctx, const char *path, uint32_t flags);
00059 SEXP_t *SEAP_read  (SEAP_CTX_t *ctx, int sd);
00060 int     SEAP_write (SEAP_CTX_t *ctx, int sd, SEXP_t *sexp);
00061 int     SEAP_close (SEAP_CTX_t *ctx, int sd);
00062 
00063 int SEAP_openfd (SEAP_CTX_t *ctx, int fd, uint32_t flags);
00064 int SEAP_openfd2 (SEAP_CTX_t *ctx, int ifd, int ofd, uint32_t flags);
00065 
00066 SEAP_msg_t *SEAP_msg_new (void);
00067 void        SEAP_msg_free (SEAP_msg_t *msg);
00068 int         SEAP_msg_set (SEAP_msg_t *msg, SEXP_t *sexp);
00069 SEXP_t     *SEAP_msg_get (SEAP_msg_t *msg);
00070 
00071 int     SEAP_msgattr_set (SEAP_msg_t *msg, const char *attr, SEXP_t *value);
00072 SEXP_t *SEAP_msgattr_get (SEAP_msg_t *msg, const char *name);
00073 
00074 int SEAP_recvsexp (SEAP_CTX_t *ctx, int sd, SEXP_t **sexp);
00075 int SEAP_recvmsg  (SEAP_CTX_t *ctx, int sd, SEAP_msg_t **seap_msg);
00076 
00077 int SEAP_sendsexp (SEAP_CTX_t *ctx, int sd, SEXP_t *sexp);
00078 int SEAP_sendmsg  (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *seap_msg);
00079 
00080 int SEAP_reply (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *rep_msg, SEAP_msg_t *req_msg);
00081 
00082 int SEAP_senderr (SEAP_CTX_t *ctx, int sd, SEAP_err_t *err);
00083 int SEAP_recverr (SEAP_CTX_t *ctx, int sd, SEAP_err_t **err);
00084 int SEAP_recverr_byid (SEAP_CTX_t *ctx, int sd, SEAP_err_t **err, SEAP_msgid_t id);
00085 
00086 int SEAP_replyerr (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *rep_msg, uint32_t e);
00087 
00088 #ifdef __cplusplus
00089 }
00090 #endif
00091 
00092 #endif /* SEAP_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines