1 /*Copyright (C) 2005 Red Hat, Inc. */
2
3 /*Object: semanage_ibendport_t (Infiniband Pkey)
4 *Object: semanage_ibendport_key_t (Infiniband Pkey Key)
5 *Implements: record_t (Database Record)
6 *Implements: record_key_t (Database Record Key)
7 */
8
9 #include <sepol/context_record.h>
10 #include <sepol/ibendport_record.h>
11
12 typedef sepol_context_t semanage_context_t;
13 typedef sepol_ibendport_t semanage_ibendport_t;
14 typedef sepol_ibendport_key_t semanage_ibendport_key_t;
15 #define _SEMANAGE_IBENDPORT_DEFINED_
16 #define _SEMANAGE_CONTEXT_DEFINED_
17
18 typedef semanage_ibendport_t record_t;
19 typedef semanage_ibendport_key_t record_key_t;
20 #define DBASE_RECORD_DEFINED
21
22 #include "ibendport_internal.h"
23 #include "handle.h"
24 #include "database.h"
25
semanage_ibendport_compare(const semanage_ibendport_t * ibendport,const semanage_ibendport_key_t * key)26 int semanage_ibendport_compare(const semanage_ibendport_t *ibendport,
27 const semanage_ibendport_key_t *key)
28 {
29 return sepol_ibendport_compare(ibendport, key);
30 }
31
hidden_def(semanage_ibendport_compare)32 hidden_def(semanage_ibendport_compare)
33
34 int semanage_ibendport_compare2(const semanage_ibendport_t *ibendport,
35 const semanage_ibendport_t *ibendport2)
36 {
37 return sepol_ibendport_compare2(ibendport, ibendport2);
38 }
39
hidden_def(semanage_ibendport_compare2)40 hidden_def(semanage_ibendport_compare2)
41
42 hidden int semanage_ibendport_compare2_qsort(const semanage_ibendport_t **ibendport,
43 const semanage_ibendport_t **ibendport2)
44 {
45 return sepol_ibendport_compare2(*ibendport, *ibendport2);
46 }
47
semanage_ibendport_key_create(semanage_handle_t * handle,const char * ibdev_name,int port,semanage_ibendport_key_t ** key_ptr)48 int semanage_ibendport_key_create(semanage_handle_t *handle,
49 const char *ibdev_name,
50 int port,
51 semanage_ibendport_key_t **key_ptr)
52 {
53 return sepol_ibendport_key_create(handle->sepolh, ibdev_name, port, key_ptr);
54 }
55
semanage_ibendport_key_extract(semanage_handle_t * handle,const semanage_ibendport_t * ibendport,semanage_ibendport_key_t ** key_ptr)56 int semanage_ibendport_key_extract(semanage_handle_t *handle,
57 const semanage_ibendport_t *ibendport,
58 semanage_ibendport_key_t **key_ptr)
59 {
60 return sepol_ibendport_key_extract(handle->sepolh, ibendport, key_ptr);
61 }
62
hidden_def(semanage_ibendport_key_extract)63 hidden_def(semanage_ibendport_key_extract)
64
65 void semanage_ibendport_key_free(semanage_ibendport_key_t *key)
66 {
67 sepol_ibendport_key_free(key);
68 }
69
hidden_def(semanage_ibendport_key_free)70 hidden_def(semanage_ibendport_key_free)
71
72 int semanage_ibendport_get_ibdev_name(semanage_handle_t *handle,
73 const semanage_ibendport_t *ibendport,
74 char **ibdev_name_ptr)
75 {
76 return sepol_ibendport_get_ibdev_name(handle->sepolh, ibendport, ibdev_name_ptr);
77 }
78
hidden_def(semanage_ibendport_get_ibdev_name)79 hidden_def(semanage_ibendport_get_ibdev_name)
80
81 int semanage_ibendport_set_ibdev_name(semanage_handle_t *handle,
82 semanage_ibendport_t *ibendport,
83 const char *ibdev_name)
84 {
85 return sepol_ibendport_set_ibdev_name(handle->sepolh, ibendport, ibdev_name);
86 }
87
hidden_def(semanage_ibendport_set_ibdev_name)88 hidden_def(semanage_ibendport_set_ibdev_name)
89
90 int semanage_ibendport_get_port(const semanage_ibendport_t *ibendport)
91 {
92 return sepol_ibendport_get_port(ibendport);
93 }
94
hidden_def(semanage_ibendport_get_port)95 hidden_def(semanage_ibendport_get_port)
96
97 void semanage_ibendport_set_port(semanage_ibendport_t *ibendport, int port)
98 {
99 sepol_ibendport_set_port(ibendport, port);
100 }
101
hidden_def(semanage_ibendport_set_port)102 hidden_def(semanage_ibendport_set_port)
103
104 semanage_context_t *semanage_ibendport_get_con(const semanage_ibendport_t *ibendport)
105 {
106 return sepol_ibendport_get_con(ibendport);
107 }
108
hidden_def(semanage_ibendport_get_con)109 hidden_def(semanage_ibendport_get_con)
110
111 int semanage_ibendport_set_con(semanage_handle_t *handle,
112 semanage_ibendport_t *ibendport,
113 semanage_context_t *con)
114 {
115 return sepol_ibendport_set_con(handle->sepolh, ibendport, con);
116 }
117
hidden_def(semanage_ibendport_set_con)118 hidden_def(semanage_ibendport_set_con)
119
120 int semanage_ibendport_create(semanage_handle_t *handle,
121 semanage_ibendport_t **ibendport_ptr)
122 {
123 return sepol_ibendport_create(handle->sepolh, ibendport_ptr);
124 }
125
hidden_def(semanage_ibendport_create)126 hidden_def(semanage_ibendport_create)
127
128 int semanage_ibendport_clone(semanage_handle_t *handle,
129 const semanage_ibendport_t *ibendport,
130 semanage_ibendport_t **ibendport_ptr)
131 {
132 return sepol_ibendport_clone(handle->sepolh, ibendport, ibendport_ptr);
133 }
134
hidden_def(semanage_ibendport_clone)135 hidden_def(semanage_ibendport_clone)
136
137 void semanage_ibendport_free(semanage_ibendport_t *ibendport)
138 {
139 sepol_ibendport_free(ibendport);
140 }
141
142 hidden_def(semanage_ibendport_free)
143
144 /*key base functions */
145 record_table_t SEMANAGE_IBENDPORT_RTABLE = {
146 .create = semanage_ibendport_create,
147 .key_extract = semanage_ibendport_key_extract,
148 .key_free = semanage_ibendport_key_free,
149 .clone = semanage_ibendport_clone,
150 .compare = semanage_ibendport_compare,
151 .compare2 = semanage_ibendport_compare2,
152 .compare2_qsort = semanage_ibendport_compare2_qsort,
153 .free = semanage_ibendport_free,
154 };
155