summaryrefslogtreecommitdiff
path: root/include/gammu-security.h
blob: 313646e486b27bcb58f24558716daa2b0193146c (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/**
 * \file gammu-security.h
 * \author Michal Čihař
 *
 * Security functions.
 */
#ifndef __gammu_security_h
#define __gammu_security_h

#ifdef	__cplusplus
extern "C" {
#endif

/**
 * \defgroup Security Security
 * Security related operations with phone.
 */

#include <gammu-limits.h>
#include <gammu-error.h>
#include <gammu-statemachine.h>

/**
 * Definition of security codes.
 *
 * \ingroup Security
 */
typedef enum {
	/**
	 * Security code.
	 */
	SEC_SecurityCode = 0x01,
	/**
	 * PIN.
	 */
	SEC_Pin,
	/**
	 * PIN 2.
	 */
	SEC_Pin2,
	/**
	 * PUK.
	 */
	SEC_Puk,
	/**
	 * PUK 2.
	 */
	SEC_Puk2,
	/**
	 * Code not needed.
	 */
	SEC_None,
	/**
	 * Phone code needed.
	 */
	SEC_Phone,
	/**
	 * Network code needed.
	 */
	SEC_Network,
} GSM_SecurityCodeType;

/**
 * Security code definition.
 *
 * \ingroup Security
 */
typedef struct {
	/**
	 * Type of the code.
	 */
	GSM_SecurityCodeType Type;
	/**
	 * Actual code.
	 */
	char Code[GSM_SECURITY_CODE_LEN + 1];
	/**
	 * New PIN code.
	 *
	 * Some phones require to set PIN on entering PUK, you can
	 * provide it here.
	 */
	char NewPIN[GSM_SECURITY_CODE_LEN + 1];
} GSM_SecurityCode;

/**
 * Enters security code (PIN, PUK,...) .
 *
 * \ingroup Security
 */
GSM_Error GSM_EnterSecurityCode(GSM_StateMachine * s, GSM_SecurityCode * Code);

/**
 * Queries whether some security code needs to be entered.
 *
 * \ingroup Security
 */
GSM_Error GSM_GetSecurityStatus(GSM_StateMachine * s,
				GSM_SecurityCodeType * Status);

#ifdef	__cplusplus
}
#endif
#endif

/* Editor configuration
 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72:
 */