blob: 63ba6c3cde9543cd3edf6e428c520c13f578ef67 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
/*
* Copyright (c) 2015 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __included_vppjni_h__
#define __included_vppjni_h__
#include <vnet/vnet.h>
#include <vnet/ip/ip.h>
#include <vnet/api_errno.h>
#include <vlibapi/api.h>
#include <vlibmemory/api.h>
#include <jni.h>
#include <japi/vppjni_bridge_domain.h>
typedef struct {
u8 * name;
u32 value;
} name_sort_t;
typedef struct {
u8 valid; // used in a vector of sw_interface_details_t
u8 interface_name[64];
u32 sw_if_index;
u32 sup_sw_if_index;
u32 l2_address_length;
u8 l2_address[8];
u8 admin_up_down;
u8 link_up_down;
u8 link_duplex;
u8 link_speed;
u32 sub_id;
u8 sub_dot1ad;
u8 sub_number_of_tags;
u16 sub_outer_vlan_id;
u16 sub_inner_vlan_id;
u8 sub_exact_match;
u8 sub_default;
u8 sub_outer_vlan_id_any;
u8 sub_inner_vlan_id_any;
u32 vtr_op;
u32 vtr_push_dot1q;
u32 vtr_tag1;
u32 vtr_tag2;
} sw_interface_details_t;
typedef struct {
u8 * interface_name;
u32 sw_if_index;
/*
* Subinterface ID. A number 0-N to uniquely identify
* this subinterface under the super interface
*/
u32 sub_id;
/* 0 = dot1q, 1=dot1ad */
u8 sub_dot1ad;
/* Number of tags 0-2 */
u8 sub_number_of_tags;
u16 sub_outer_vlan_id;
u16 sub_inner_vlan_id;
u8 sub_exact_match;
u8 sub_default;
u8 sub_outer_vlan_id_any;
u8 sub_inner_vlan_id_any;
/* vlan tag rewrite */
u32 vtr_op;
u32 vtr_push_dot1q;
u32 vtr_tag1;
u32 vtr_tag2;
} sw_interface_subif_t;
typedef struct {
u64 ip4;
u64 ip6;
u64 unicast;
u64 multicast;
u64 broadcast;
u64 discard;
u64 fifo_full;
u64 error;
u64 unknown_proto;
u64 miss;
} packet_counters_t;
typedef struct {
u64 octets;
packet_counters_t pkts;
} if_counters_t;
typedef struct {
u8 valid;
u32 sw_if_index;
if_counters_t rx;
if_counters_t tx;
} sw_interface_stats_t;
typedef struct {
/* Context IDs */
volatile u32 context_id_sent;
volatile u32 context_id_received;
/* Spinlock */
volatile u32 lock;
u32 tag;
/* To recycle pseudo-synchronous message code from vpe_api_test... */
volatile u32 result_ready;
volatile i32 retval;
volatile u8 *shmem_result;
/* thread cleanup */
pthread_key_t cleanup_rx_thread_key;
/* attachment of rx thread to java thread */
JNIEnv *jenv;
JavaVM *jvm;
jclass jcls;
jmethodID jmtdIfDetails; // interfaceDetails method
uword *callback_hash; // map context_id => jobject
uword *ping_hash; // map ping context_id => msg type called
/* Timestamp */
clib_time_t clib_time;
/* connected indication */
u8 is_connected;
/* context -> non-trivial reply hash */
uword * reply_hash;
u32 saved_reply_count;
/* interface name map */
uword * sw_if_index_by_interface_name;
/* interface counters */
sw_interface_stats_t * sw_if_stats_by_sw_if_index;
/* interface table */
sw_interface_details_t * sw_if_table;
/* interface indices of responses to one sw_if_dump request */
u8 collect_indi
|