Introduce LiveGetDevice function

remotes/origin/master-1.2.x
Eric Leblond 15 years ago committed by Victor Julien
parent e893e860d4
commit 745b61171a

@ -93,6 +93,34 @@ char *LiveGetDeviceName(int number) {
return NULL;
}
/**
* \brief Get a pointer to the device at idx
*
* \param number idx of the device in our list
*
* \retval ptr pointer to the string containing the device
* \retval NULL on error
*/
LiveDevice *LiveGetDevice(char *name) {
int i = 0;
LiveDevice *pd;
if (name == NULL) {
SCLogWarning(SC_ERR_INVALID_VALUE, "Name of device should not be null");
return NULL;
}
TAILQ_FOREACH(pd, &live_devices, next) {
if (!strcmp(name, pd->dev)) {
return pd;
}
i++;
}
return NULL;
}
int LiveBuildDeviceList(char * runmode)

@ -30,6 +30,7 @@ typedef struct LiveDevice_ {
int LiveRegisterDevice(char *dev);
int LiveGetDeviceCount(void);
char *LiveGetDeviceName(int number);
LiveDevice *LiveGetDevice(char *dev);
int LiveBuildDeviceList(char * base);
#endif /* __UTIL_DEVICE_H__ */

Loading…
Cancel
Save