Open SCAP Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
_seap-scheme.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_SCHEME_H
25 #define _SEAP_SCHEME_H
26 
27 #include <stddef.h>
28 #include <stdint.h>
29 #include <unistd.h>
30 #include "_sexp-types.h"
31 #include "_seap-types.h"
32 #include "seap-descriptor.h"
33 #include "generic/common.h"
34 #include "../../../common/util.h"
35 
36 OSCAP_HIDDEN_START;
37 
38 typedef struct {
39  const char *schstr;
40  int (*sch_connect) (SEAP_desc_t *, const char *, uint32_t);
41  int (*sch_openfd) (SEAP_desc_t *, int, uint32_t);
42  int (*sch_openfd2) (SEAP_desc_t *, int, int, uint32_t);
43  ssize_t (*sch_recv) (SEAP_desc_t *, void *, size_t, uint32_t);
44  ssize_t (*sch_send) (SEAP_desc_t *, void *, size_t, uint32_t);
45  int (*sch_close) (SEAP_desc_t *, uint32_t);
46  ssize_t (*sch_sendsexp) (SEAP_desc_t *, SEXP_t *, uint32_t);
47  int (*sch_select) (SEAP_desc_t *, int, uint16_t, uint32_t);
49 
50 extern const SEAP_schemefn_t __schtbl[];
51 
52 #define SCH_CONNECT(idx, ...) __schtbl[idx].sch_connect (__VA_ARGS__)
53 #define SCH_OPENFD(idx, ...) __schtbl[idx].sch_openfd (__VA_ARGS__)
54 #define SCH_OPENFD2(idx, ...) __schtbl[idx].sch_openfd2 (__VA_ARGS__)
55 #define SCH_RECV(idx, ...) __schtbl[idx].sch_recv (__VA_ARGS__)
56 #define SCH_SEND(idx, ...) __schtbl[idx].sch_send (__VA_ARGS__)
57 #define SCH_CLOSE(idx, ...) __schtbl[idx].sch_close (__VA_ARGS__)
58 #define SCH_SENDSEXP(idx, ...) __schtbl[idx].sch_sendsexp (__VA_ARGS__)
59 #define SCH_SELECT(idx, ...) __schtbl[idx].sch_select (__VA_ARGS__)
60 
61 #define SEAP_IO_EVREAD 0x01
62 #define SEAP_IO_EVWRITE 0x02
63 #define SEAP_IO_EVANY 0x08
64 
65 #define SEAP_RECVBUF_SIZE 4*4096
66 #define SEAP_SENDBUF_SIZE 4*4096
67 
68 SEAP_scheme_t SEAP_scheme_search (const SEAP_schemefn_t fntable[], const char *sch, size_t schlen);
69 
70 /* console */
71 #include "sch_cons.h"
72 #define SCH_CONS 0
73 
74 /* dummy */
75 #include "sch_dummy.h"
76 #define SCH_DUMMY 1
77 
78 /* generic */
79 #include "sch_generic.h"
80 #define SCH_GENERIC 2
81 
82 /* pipe */
83 #include "sch_pipe.h"
84 #define SCH_PIPE 3
85 
86 #define SCH_NONE 255
87 
88 OSCAP_HIDDEN_END;
89 
90 #endif /* _SEAP_SCHEME_H */
Definition: _seap-scheme.h:38
Definition: seap-descriptor.h:48
Definition: sexp-types.h:82