00001 /* 00002 * hdhomerun_discover.h 00003 * 00004 * Copyright © 2006-2007 Silicondust USA Inc. <www.silicondust.com>. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 3 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 00018 * 00019 * As a special exception to the GNU Lesser General Public License, 00020 * you may link, statically or dynamically, an application with a 00021 * publicly distributed version of the Library to produce an 00022 * executable file containing portions of the Library, and 00023 * distribute that executable file under terms of your choice, 00024 * without any of the additional requirements listed in clause 4 of 00025 * the GNU Lesser General Public License. 00026 * 00027 * By "a publicly distributed version of the Library", we mean 00028 * either the unmodified Library as distributed by Silicondust, or a 00029 * modified version of the Library that is distributed under the 00030 * conditions defined in the GNU Lesser General Public License. 00031 */ 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00036 struct hdhomerun_discover_device_t { 00037 uint32_t ip_addr; 00038 uint32_t device_type; 00039 uint32_t device_id; 00040 uint8_t tuner_count; 00041 }; 00042 00043 /* 00044 * Find devices. 00045 * 00046 * The device information is stored in caller-supplied array of hdhomerun_discover_device_t vars. 00047 * Multiple attempts are made to find devices. 00048 * Execution time is typically 400ms if max_count is not reached. 00049 * 00050 * Set target_ip to zero to auto-detect the IP address. 00051 * Set device_type to HDHOMERUN_DEVICE_TYPE_TUNER to detect HDHomeRun tuner devices. 00052 * Set device_id to HDHOMERUN_DEVICE_ID_WILDCARD to detect all device ids. 00053 * 00054 * Returns the number of devices found. 00055 * Retruns -1 on error. 00056 */ 00057 extern LIBTYPE int hdhomerun_discover_find_devices_custom(uint32_t target_ip, uint32_t device_type, uint32_t device_id, struct hdhomerun_discover_device_t result_list[], int max_count); 00058 00059 /* 00060 * Optional: persistent discover instance available for discover polling use. 00061 */ 00062 extern LIBTYPE struct hdhomerun_discover_t *hdhomerun_discover_create(void); 00063 extern LIBTYPE void hdhomerun_discover_destroy(struct hdhomerun_discover_t *ds); 00064 extern LIBTYPE int hdhomerun_discover_find_devices(struct hdhomerun_discover_t *ds, uint32_t target_ip, uint32_t device_type, uint32_t device_id, struct hdhomerun_discover_device_t result_list[], int max_count); 00065 00066 /* 00067 * Verify that the device ID given is valid. 00068 * 00069 * The device ID contains a self-check sequence that detects common user input errors including 00070 * single-digit errors and two digit transposition errors. 00071 * 00072 * Returns TRUE if valid. 00073 * Returns FALSE if not valid. 00074 */ 00075 extern LIBTYPE bool_t hdhomerun_discover_validate_device_id(uint32_t device_id); 00076 00077 /* 00078 * Detect if an IP address is multicast. 00079 * 00080 * Returns TRUE if multicast. 00081 * Returns FALSE if zero, unicast, expermental, or broadcast. 00082 */ 00083 extern LIBTYPE bool_t hdhomerun_discover_is_ip_multicast(uint32_t ip_addr); 00084 00085 #ifdef __cplusplus 00086 } 00087 #endif
1.6.3