1 /* Copyright (c) 2011 Nicira Networks
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
17 #define VLAN_BITMAP_H 1
23 /* A "VLAN bitmap" is a 4096-bit bitmap that represents a set. A 1-bit
24 * indicates that the respective VLAN is a member of the set, a 0-bit indicates
25 * that it is not. There is one wrinkle: NULL is a valid value that indicates
26 * either that all VLANs are or are not members, depending on the vlan_bitmap.
28 * This is empirically a useful data structure. */
30 unsigned long *vlan_bitmap_from_array(const int64_t *vlans, size_t n_vlans);
31 bool vlan_bitmap_equal(const unsigned long *a, const unsigned long *b);
33 /* Returns a new copy of 'vlans'. */
34 static inline unsigned long *
35 vlan_bitmap_clone(const unsigned long *vlans)
37 return vlans ? bitmap_clone(vlans, 4096) : NULL;
40 #endif /* lib/vlan-bitmap.h */