static void dump_descriptor(le_event_t * event){ le_characteristic_descriptor_event_t * devent = (le_characteristic_descriptor_event_t *) event; le_characteristic_descriptor_t descriptor = devent->characteristic_descriptor; printf(" *** descriptor *** handle 0x%02x, value ", descriptor.handle); printf_hexdump(devent->value, devent->value_length); printUUID(descriptor.uuid128, descriptor.uuid16); }
/** * Writes out the guidStore to persistent storage represented by file, * replacing the contents of the original contents of the file. */ void writeGuidStore(GuidStore *guidStore, FILE *file) { rewind(file); for (GuidStore *store = guidStore; store != NULL; store = store->nxt) { char uuidStr[FORMATTED_GUID_LEN+1]; printUUID((u_char *)store->uuid, (u_char *)uuidStr, FORMATTED_GUID_LEN); fprintf(file, "%s=%u\n", uuidStr, store->dsIndex); } fflush(file); // chop off anything that may be lingering from before truncateOpenFile(file); }
/** * Populates the host_descr structure with, computer name for hostname, * processor architecture, os_name (Windows), os version, and BIOS UUID. */ void readHidCounters(HSP *sp, SFLHost_hid_counters *hid){ DWORD dwRes; OSVERSIONINFO osvi; SYSTEM_INFO si; #define MAX_FDQN_CHARS 255 char dnsBuf[MAX_FDQN_CHARS+1]; DWORD dnsLen = MAX_FDQN_CHARS; if (GetComputerNameEx(ComputerNameDnsHostname,dnsBuf,&dnsLen)) { uint32_t copyLen = dnsLen < SFL_MAX_HOSTNAME_CHARS ? dnsLen : SFL_MAX_HOSTNAME_CHARS; memcpy(hid->hostname.str, dnsBuf, copyLen); hid->hostname.str[copyLen] = '\0'; hid->hostname.len = copyLen; } hid->os_name = SFLOS_windows; ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); dwRes = GetVersionEx(&osvi); if (dwRes){ sprintf_s(hid->os_release.str, SFL_MAX_OSRELEASE_CHARS,"%d.%d.%d %s", osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber, osvi.szCSDVersion); hid->os_release.len = (uint32_t)strnlen(hid->os_release.str, SFL_MAX_OSRELEASE_CHARS); } GetNativeSystemInfo(&si); hid->machine_type = SFLMT_unknown; switch(si.wProcessorArchitecture){ case PROCESSOR_ARCHITECTURE_AMD64: hid->machine_type = SFLMT_x86_64; break; case PROCESSOR_ARCHITECTURE_IA64: hid->machine_type = SFLMT_ia64; break; case PROCESSOR_ARCHITECTURE_INTEL: hid->machine_type = SFLMT_x86; break; } dwRes = readSystemUUID(hid->uuid); if (LOG_INFO <= debug) { u_char uuidbuf[FORMATTED_GUID_LEN+1]; printUUID(hid->uuid, uuidbuf, FORMATTED_GUID_LEN); myLog(LOG_INFO,"readHidCounters:\n\thostname:\t%s\n\trelease:\t%s\n\tmachine_type:\t%d\n\tuuid:\t%s\n", hid->hostname.str, hid->os_release.str, hid->machine_type, uuidbuf); } }
static void dump_service(le_service_t * service){ printf(" *** service *** start group handle %02x, end group handle %02x", service->start_group_handle, service->end_group_handle); printUUID(service->uuid128, service->uuid16); }
static void dump_characteristic(le_characteristic_t * characteristic){ printf(" *** characteristic *** properties %x, start handle 0x%02x, value handle 0x%02x, end handle 0x%02x", characteristic->properties, characteristic->start_handle, characteristic->value_handle, characteristic->end_handle); printUUID(characteristic->uuid128, characteristic->uuid16); }
static void dump_service(le_service_t * service){ printf(" * service: [0x%04x-0x%04x], uuid ", service->start_group_handle, service->end_group_handle); printUUID(service->uuid128, service->uuid16); printf("\n"); }
static void dump_characteristic(le_characteristic_t * characteristic){ printf(" * characteristic: [0x%04x-0x%04x-0x%04x], properties 0x%02x, uuid ", characteristic->start_handle, characteristic->value_handle, characteristic->end_handle, characteristic->properties); printUUID(characteristic->uuid128, characteristic->uuid16); printf("\n"); }