Open SCAP Library
/home/pvrabec/project/openscap/openscap-0.8.1/src/OVAL/probes/SEAP/public/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 <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 /* SEAP_H */