[go: up one dir, main page]

File: fetion_login.h

package info (click to toggle)
libofetion 2.2.2-1.1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 528 kB
  • ctags: 724
  • sloc: ansic: 8,348; xml: 487; makefile: 3
file content (118 lines) | stat: -rw-r--r-- 5,717 bytes parent folder | download | duplicates (2)
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
109
110
111
112
113
114
115
116
117
118
/***************************************************************************
 *   Copyright (C) 2010 by lwp                                             *
 *   levin108@gmail.com                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.            *
 *                                                                         *
 *   OpenSSL linking exception                                             *
 *   --------------------------                                            *
 *   If you modify this Program, or any covered work, by linking or        *
 *   combining it with the OpenSSL project's "OpenSSL" library (or a       *
 *   modified version of that library), containing parts covered by        *
 *   the terms of OpenSSL/SSLeay license, the licensors of this            *
 *   Program grant you additional permission to convey the resulting       *
 *   work. Corresponding Source for a non-source form of such a            *
 *   combination shall include the source code for the parts of the        *
 *   OpenSSL library used as well as that of the covered work.             *
 ***************************************************************************/

#ifndef FETION_LOGIN_H
#define FETION_LOGIN_H
enum
{
	PASSWORD_ERROR_MAX = 0	
};

/**
 * ssi login through https to get some information as user-id
 * @param user Global User object initialized before login
 * @return Returns the response string by ssi server 
 * 	   NULL if error occuered , need to be freed after use.
 */
extern char* ssi_auth_action(User *user);


/**
 * sipc register action to sipc server.
 * @param user Global User object initialized before login
 * @returns Returns the response string by sipc server
 * 	NULL if error occured , need to be freed after use.
 */
extern char* sipc_reg_action(User *user);

/**
 * parse the ssi registration response string to get information as user-id
 * @param ssi_response The return value of function ssi_auth_action.
 * @param user Global User object initialized before login.
 * 	The result code will be store in its member variable 'loginStatus'
 */
extern void parse_ssi_auth_response(const char *ssi_response, User *user);

/**
 * parse the sipc registration response string to get nonce string and key string
 * for sipc authentication
 * @param reg_response The return value of function sipc_auth_action
 * @param nouce Will be filled by the nonce string parsed from reg_response.
 * 	need to be freed after use.
 * @param key Will be filled by the key string parsed from reg_response.
 * 	need to be freed after use.
 */
extern void parse_sipc_reg_response(const char *reg_response, char **nouce, char **key) ;

/**
 * generate response string for sipc authentication.
 * @param nouce. Nonce string get from function "parse_sipc_reg_response()"
 * @param userid. UserId get from ssi register result.
 * @param password. Nothing special,just your password.
 * @param publickey. Key string get from function "parse_sipc_reg_response()" , which in fact unused.
 * @param key. Private key string need for generate sipc authentication response string. 
 * 	and can be generated by the function "generate_aes_key()"
 * @return The response string generated for sipc authentication.Need to be freed after use.
 */
extern char* generate_response(const char *nouce, const char *userid,
	const char *password, const char *publickey, const char *key);

/**
 * sipc authentication using the response string generated by the function "generate_response()"
 * @param user Global User object initialized before login.
 * @return sipc authencation response string from sipc server.Need to be freed after use.
 */
extern char* sipc_aut_action(User *user, const char *response);

/**
 * parse the user`s personal information and user`s contact information
 *  from the sipc authentication response string.
 *  @param auth_response. Response string returns by the function "sipc_aut_action()"
 *  @user Global User object initialized before login,and will be filled with 
 *  	user`s personal information and user`s contact list information if success,
 *  	orelse the member variable "loginStatus" will be filled with errno.
 */
extern int parse_sipc_auth_response(const char *auth_response, User *user, int *group_count, int *buddy_count);

/**
 * generate comfirm code picture.
 */
extern void generate_pic_code(User *user);

/**
 * generate private key string for generating response string for sipc authentication
 * @returns Need to be freed after use.
 */
extern char* generate_aes_key();

extern char* hash_password(const char *password);

#endif