Open SCAP Library
seap.h
1 /*
2  * Copyright 2009 Red Hat Inc., Durham, North Carolina.
3  * All Rights Reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors:
20  * "Daniel Kopecek" <dkopecek@redhat.com>
21  */
22 
23 #pragma once
24 #ifndef SEAP_H
25 #define SEAP_H
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #ifndef SEAP_MSGID_BITS
32 # define SEAP_MSGID_BITS 32
33 #endif
34 
35 #include <stdint.h>
36 #include <errno.h>
37 #include <sexp.h>
38 #include <seap-types.h>
39 #include <seap-message.h>
40 #include <seap-command.h>
41 #include <seap-error.h>
42 #include "oscap_export.h"
43 #include "sch_queue.h"
44 
45 #ifndef EOPNOTSUPP
46 # define EOPNOTSUPP 1001
47 #endif
48 
49 #ifndef ECANCELED
50 # define ECANCELED 1002
51 #endif
52 
53 OSCAP_API SEAP_CTX_t *SEAP_CTX_new (void);
54 OSCAP_API void SEAP_CTX_init (SEAP_CTX_t *ctx);
55 OSCAP_API void SEAP_CTX_free (SEAP_CTX_t *ctx);
56 
57 OSCAP_API int SEAP_connect(SEAP_CTX_t *ctx);
58 OSCAP_API int SEAP_listen (SEAP_CTX_t *ctx, int sd, uint32_t maxcli);
59 OSCAP_API int SEAP_accept (SEAP_CTX_t *ctx, int sd);
60 
61 OSCAP_API int SEAP_open (SEAP_CTX_t *ctx, const char *path, uint32_t flags);
62 OSCAP_API SEXP_t *SEAP_read (SEAP_CTX_t *ctx, int sd);
63 OSCAP_API int SEAP_write (SEAP_CTX_t *ctx, int sd, SEXP_t *sexp);
64 OSCAP_API int SEAP_close (SEAP_CTX_t *ctx, int sd);
65 
66 OSCAP_API int SEAP_openfd (SEAP_CTX_t *ctx, int fd, uint32_t flags);
67 OSCAP_API int SEAP_openfd2 (SEAP_CTX_t *ctx, int ifd, int ofd, uint32_t flags);
68 OSCAP_API int SEAP_add_probe(SEAP_CTX_t *ctx, sch_queuedata_t *data);
69 
70 OSCAP_API SEAP_msg_t *SEAP_msg_new (void);
71 OSCAP_API void SEAP_msg_free (SEAP_msg_t *msg);
72 OSCAP_API int SEAP_msg_set (SEAP_msg_t *msg, SEXP_t *sexp);
73 OSCAP_API SEXP_t *SEAP_msg_get (SEAP_msg_t *msg);
74 
75 OSCAP_API int SEAP_msgattr_set (SEAP_msg_t *msg, const char *attr, SEXP_t *value);
76 OSCAP_API SEXP_t *SEAP_msgattr_get (SEAP_msg_t *msg, const char *name);
77 
78 OSCAP_API int SEAP_recvsexp (SEAP_CTX_t *ctx, int sd, SEXP_t **sexp);
79 OSCAP_API int SEAP_recvmsg (SEAP_CTX_t *ctx, int sd, SEAP_msg_t **seap_msg);
80 
81 OSCAP_API int SEAP_sendsexp (SEAP_CTX_t *ctx, int sd, SEXP_t *sexp);
82 OSCAP_API int SEAP_sendmsg (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *seap_msg);
83 
84 OSCAP_API int SEAP_reply (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *rep_msg, SEAP_msg_t *req_msg);
85 
86 OSCAP_API int SEAP_senderr (SEAP_CTX_t *ctx, int sd, SEAP_err_t *err);
87 OSCAP_API int SEAP_recverr (SEAP_CTX_t *ctx, int sd, SEAP_err_t **err);
88 OSCAP_API int SEAP_recverr_byid (SEAP_CTX_t *ctx, int sd, SEAP_err_t **err, SEAP_msgid_t id);
89 
90 OSCAP_API int SEAP_replyerr (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *rep_msg, uint32_t e);
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif /* SEAP_H */
Definition: sch_queue.h:30
Definition: _seap-types.h:36
Definition: seap-error.h:34
Definition: sexp-types.h:82
Definition: _seap-message.h:38