@@ -104,6 +104,12 @@ size_t bpf_num_tables(void *program) {
104104 return mod->num_tables ();
105105}
106106
107+ size_t bpf_table_id (void *program, const char *table_name) {
108+ auto mod = static_cast <ebpf::BPFModule *>(program);
109+ if (!mod) return ~0ull ;
110+ return mod->table_id (table_name);
111+ }
112+
107113int bpf_table_fd (void *program, const char *table_name) {
108114 auto mod = static_cast <ebpf::BPFModule *>(program);
109115 if (!mod) return -1 ;
@@ -170,38 +176,26 @@ size_t bpf_table_leaf_size_id(void *program, size_t id) {
170176 return mod->table_leaf_size (id);
171177}
172178
173- int bpf_table_update (void *program, const char *table_name, const char *key, const char *leaf) {
174- auto mod = static_cast <ebpf::BPFModule *>(program);
175- if (!mod) return 0 ;
176- return mod->table_update (table_name, key, leaf);
177- }
178-
179- int bpf_table_update_id (void *program, size_t id, const char *key, const char *leaf) {
180- auto mod = static_cast <ebpf::BPFModule *>(program);
181- if (!mod) return 0 ;
182- return mod->table_update (id, key, leaf);
183- }
184-
185179int bpf_table_key_snprintf (void *program, size_t id, char *buf, size_t buflen, const void *key) {
186180 auto mod = static_cast <ebpf::BPFModule *>(program);
187- if (!mod) return 0 ;
181+ if (!mod) return - 1 ;
188182 return mod->table_key_printf (id, buf, buflen, key);
189183}
190184int bpf_table_leaf_snprintf (void *program, size_t id, char *buf, size_t buflen, const void *leaf) {
191185 auto mod = static_cast <ebpf::BPFModule *>(program);
192- if (!mod) return 0 ;
193- return mod->table_key_printf (id, buf, buflen, leaf);
186+ if (!mod) return - 1 ;
187+ return mod->table_leaf_printf (id, buf, buflen, leaf);
194188}
195189
196190int bpf_table_key_sscanf (void *program, size_t id, const char *buf, void *key) {
197191 auto mod = static_cast <ebpf::BPFModule *>(program);
198- if (!mod) return 0 ;
192+ if (!mod) return - 1 ;
199193 return mod->table_key_scanf (id, buf, key);
200194}
201195int bpf_table_leaf_sscanf (void *program, size_t id, const char *buf, void *leaf) {
202196 auto mod = static_cast <ebpf::BPFModule *>(program);
203- if (!mod) return 0 ;
204- return mod->table_key_scanf (id, buf, leaf);
197+ if (!mod) return - 1 ;
198+ return mod->table_leaf_scanf (id, buf, leaf);
205199}
206200
207201}
0 commit comments