Open SCAP Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 
43 #ifndef EOPNOTSUPP
44 # define EOPNOTSUPP 1001
45 #endif
46 
47 #ifndef ECANCELED
48 # define ECANCELED 1002
49 #endif
50 
51 SEAP_CTX_t *SEAP_CTX_new (void);
52 void SEAP_CTX_init (SEAP_CTX_t *ctx);
53 void SEAP_CTX_free (SEAP_CTX_t *ctx);
54 
55 int SEAP_connect (SEAP_CTX_t *ctx, const char *uri, uint32_t flags);
56 int SEAP_listen (SEAP_CTX_t *ctx, int sd, uint32_t maxcli);
57 int SEAP_accept (SEAP_CTX_t *ctx, int sd);
58 
59 int SEAP_open (SEAP_CTX_t *ctx, const char *path, uint32_t flags);
60 SEXP_t *SEAP_read (SEAP_CTX_t *ctx, int sd);
61 int SEAP_write (SEAP_CTX_t *ctx, int sd, SEXP_t *sexp);
62 int SEAP_close (SEAP_CTX_t *ctx, int sd);
63 
64 int SEAP_openfd (SEAP_CTX_t *ctx, int fd, uint32_t flags);
65 int SEAP_openfd2 (SEAP_CTX_t *ctx, int ifd, int ofd, uint32_t flags);
66 
67 SEAP_msg_t *SEAP_msg_new (void);
68 void SEAP_msg_free (SEAP_msg_t *msg);
69 int SEAP_msg_set (SEAP_msg_t *msg, SEXP_t *sexp);
70 SEXP_t *SEAP_msg_get (SEAP_msg_t *msg);
71 
72 int SEAP_msgattr_set (SEAP_msg_t *msg, const char *attr, SEXP_t *value);
73 SEXP_t *SEAP_msgattr_get (SEAP_msg_t *msg, const char *name);
74 
75 int SEAP_recvsexp (SEAP_CTX_t *ctx, int sd, SEXP_t **sexp);
76 int SEAP_recvmsg (SEAP_CTX_t *ctx, int sd, SEAP_msg_t **seap_msg);
77 
78 int SEAP_sendsexp (SEAP_CTX_t *ctx, int sd, SEXP_t *sexp);
79 int SEAP_sendmsg (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *seap_msg);
80 
81 int SEAP_reply (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *rep_msg, SEAP_msg_t *req_msg);
82 
83 int SEAP_senderr (SEAP_CTX_t *ctx, int sd, SEAP_err_t *err);
84 int SEAP_recverr (SEAP_CTX_t *ctx, int sd, SEAP_err_t **err);
85 int SEAP_recverr_byid (SEAP_CTX_t *ctx, int sd, SEAP_err_t **err, SEAP_msgid_t id);
86 
87 int SEAP_replyerr (SEAP_CTX_t *ctx, int sd, SEAP_msg_t *rep_msg, uint32_t e);
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 
93 #endif /* SEAP_H */
Definition: _seap-types.h:37
Definition: seap-error.h:33
Definition: sexp-types.h:82
Definition: _seap-message.h:39