open-license-manager
2014-09-15 345c7b764f0721e9bbc993a3cd7f803fd42cf943
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
 * os-dependent.hpp
 *
 *  Created on: Mar 29, 2014
 *      
 */
 
#ifndef OS_DEPENDENT_HPP_
#define OS_DEPENDENT_HPP_
 
#ifdef __cplusplus
extern "C" {
#endif
 
#include "../base/base.h"
#include <stddef.h>
//definition of size_t
#include <stdlib.h>
#ifdef __unix__
#include <stdbool.h>
#endif
 
typedef enum {
    NONE, VMWARE
} VIRTUALIZATION;
 
typedef enum {
    IFACE_TYPE_ETHERNET, IFACE_TYPE_WIRELESS
} IFACE_TYPE;
 
typedef struct {
    int id;
    char description[1024];
    unsigned char mac_address[6];
    unsigned char ipv4_address[4];
    IFACE_TYPE type;
} OsAdapterInfo;
 
typedef struct {
    int id;
    char device[255];
    unsigned char disk_sn[8];
    char label[255];
    bool preferred;
} DiskInfo;
 
FUNCTION_RETURN getAdapterInfos(OsAdapterInfo * adapterInfos,
        size_t * adapter_info_size);
FUNCTION_RETURN getDiskInfos(DiskInfo * diskInfos, size_t * disk_info_size);
FUNCTION_RETURN getUserHomePath(char[MAX_PATH]);
FUNCTION_RETURN getCpuId(unsigned char identifier[6]);
FUNCTION_RETURN getMachineName(unsigned char identifier[6]);
/**
 * Get an identifier of the machine in an os specific way.
 * In Linux it uses:
 * http://stackoverflow.com/questions/328936/getting-a-unique-id-from-a-unix-like-system
 *
 * <ul>
 * <li>Dbus if available</li>
 * </ul>
 * Can be used as a fallback in case no other methods are available.
 * Windows:
 * HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\ CurrentVersion\ProductId
 * http://sowkot.blogspot.it/2008/08/generating-unique-keyfinger-print-for.html
 * http://stackoverflow.com/questions/2842116/reliable-way-of-generating-unique-hardware-id
 *
 *
 * @param identifier
 * @return
 */
FUNCTION_RETURN getOsSpecificIdentifier(unsigned char identifier[6]);
VIRTUALIZATION getVirtualization();
void os_initialize();
 
#ifdef __cplusplus
}
#endif
 
#endif /* OS_DEPENDENT_HPP_ */