"Fossies" - the Fresh Open Source Software Archive

Member "usbutils-015/usbhid-dump/src/iface_list.h" (22 Feb 2021, 2151 Bytes) of package /linux/misc/usbutils-015.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "iface_list.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 013_vs_014.

    1 // SPDX-License-Identifier: GPL-2.0-or-later
    2 /*
    3  * usbhid-dump - interface list
    4  *
    5  * Copyright (C) 2010 Nikolai Kondrashov <spbnick@gmail.com>
    6  */
    7 
    8 #ifndef __UHD_IFACE_LIST_H__
    9 #define __UHD_IFACE_LIST_H__
   10 
   11 #include <stdint.h>
   12 #include "dev_list.h"
   13 #include "iface.h"
   14 
   15 #ifdef __cplusplus
   16 extern "C" {
   17 #endif
   18 
   19 /**
   20  * Check if an interface list is valid.
   21  *
   22  * @param list  Interface list to check.
   23  *
   24  * @return True if the interface list is valid, false otherwise.
   25  */
   26 extern bool uhd_iface_list_valid(const uhd_iface *list);
   27 
   28 /**
   29  * Check if an interface list is empty.
   30  *
   31  * @param list  Interface list to check.
   32  *
   33  * @return True if the interface list is empty, false otherwise.
   34  */
   35 static inline bool
   36 uhd_iface_list_empty(const uhd_iface *list)
   37 {
   38     return list == NULL;
   39 }
   40 
   41 /**
   42  * Calculate length of an interface list.
   43  *
   44  * @param list  The list to calculate length of.
   45  *
   46  * @return The list length.
   47  */
   48 extern size_t uhd_iface_list_len(const uhd_iface *list);
   49 
   50 /**
   51  * Free an interface list.
   52  *
   53  * @param list  The interface list to free.
   54  */
   55 extern void uhd_iface_list_free(uhd_iface *list);
   56 
   57 /**
   58  * Iterate over an interface list.
   59  *
   60  * @param _iface    Loop interface variable.
   61  * @param _list     Interface list to iterate over.
   62  */
   63 #define UHD_IFACE_LIST_FOR_EACH(_iface, _list) \
   64     for (_iface = _list; _iface != NULL; _iface = _iface->next)
   65 
   66 /**
   67  * Fetch a list of HID interfaces from a device list.
   68  *
   69  * @param dev_list      The device list to fetch interface list from.
   70  * @param plist         Location for the resulting list head; could be NULL.
   71  *
   72  * @return Libusb error code.
   73  */
   74 extern enum libusb_error uhd_iface_list_new(uhd_dev    *dev_list,
   75                                             uhd_iface **plist);
   76 
   77 /**
   78  * Filter an interface list by an interface number.
   79  *
   80  * @param plist     The original list head.
   81  * @param number    The interface number to match against.
   82  *
   83  * @return The resulting list head.
   84  */
   85 extern uhd_iface *uhd_iface_list_fltr_by_num(uhd_iface *list,
   86                                              uint8_t    number);
   87 
   88 #ifdef __cplusplus
   89 } /* extern "C" */
   90 #endif
   91 
   92 #endif /* __UHD_IFACE_LIST_H__ */