Home | History | Annotate | Download | only in includes
      1 /*
      2  * Copyright (c) 2015 PLUMgrid, Inc.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  * http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef BPF_COMMON_H
     18 #define BPF_COMMON_H
     19 
     20 #include <stdint.h>
     21 #include <stdlib.h>
     22 
     23 #ifdef __cplusplus
     24 extern "C" {
     25 #endif
     26 
     27 void * bpf_module_create_b(const char *filename, const char *proto_filename, unsigned flags);
     28 void * bpf_module_create_c(const char *filename, unsigned flags, const char *cflags[], int ncflags);
     29 void * bpf_module_create_c_from_string(const char *text, unsigned flags, const char *cflags[], int ncflags);
     30 void bpf_module_destroy(void *program);
     31 char * bpf_module_license(void *program);
     32 unsigned bpf_module_kern_version(void *program);
     33 size_t bpf_num_functions(void *program);
     34 const char * bpf_function_name(void *program, size_t id);
     35 void * bpf_function_start_id(void *program, size_t id);
     36 void * bpf_function_start(void *program, const char *name);
     37 size_t bpf_function_size_id(void *program, size_t id);
     38 size_t bpf_function_size(void *program, const char *name);
     39 size_t bpf_num_tables(void *program);
     40 size_t bpf_table_id(void *program, const char *table_name);
     41 int bpf_table_fd(void *program, const char *table_name);
     42 int bpf_table_fd_id(void *program, size_t id);
     43 int bpf_table_type(void *program, const char *table_name);
     44 int bpf_table_type_id(void *program, size_t id);
     45 size_t bpf_table_max_entries(void *program, const char *table_name);
     46 size_t bpf_table_max_entries_id(void *program, size_t id);
     47 int bpf_table_flags(void *program, const char *table_name);
     48 int bpf_table_flags_id(void *program, size_t id);
     49 const char * bpf_table_name(void *program, size_t id);
     50 const char * bpf_table_key_desc(void *program, const char *table_name);
     51 const char * bpf_table_key_desc_id(void *program, size_t id);
     52 const char * bpf_table_leaf_desc(void *program, const char *table_name);
     53 const char * bpf_table_leaf_desc_id(void *program, size_t id);
     54 size_t bpf_table_key_size(void *program, const char *table_name);
     55 size_t bpf_table_key_size_id(void *program, size_t id);
     56 size_t bpf_table_leaf_size(void *program, const char *table_name);
     57 size_t bpf_table_leaf_size_id(void *program, size_t id);
     58 int bpf_table_key_snprintf(void *program, size_t id, char *buf, size_t buflen, const void *key);
     59 int bpf_table_leaf_snprintf(void *program, size_t id, char *buf, size_t buflen, const void *leaf);
     60 int bpf_table_key_sscanf(void *program, size_t id, const char *buf, void *key);
     61 int bpf_table_leaf_sscanf(void *program, size_t id, const char *buf, void *leaf);
     62 
     63 #ifdef __cplusplus
     64 }
     65 #endif
     66 
     67 #endif
     68