Introduce EIBC_RETURN_UINT*
[bcusdk.git] / eibd / client / mcauthorize.c
blobc23cde39aaea1dee1d3cc7c3f7254171a2e399dd
1 /*
2 EIBD client library
3 Copyright (C) 2005-2007 Martin Koegler <mkoegler@auto.tuwien.ac.at>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 In addition to the permissions in the GNU General Public License,
11 you may link the compiled version of this file into combinations
12 with other programs, and distribute those combinations without any
13 restriction coming from the use of this file. (The General Public
14 License restrictions do apply in other respects; for example, they
15 cover modification of the file, and distribution when not linked into
16 a combine executable.)
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "eibclient.h"
29 #include "eibclient-int.h"
31 static int
32 MC_Authorize_complete (EIBConnection * con)
34 EIBC_GETREQUEST
35 EIBC_CHECKRESULT (EIB_MC_AUTHORIZE, 3)
36 EIBC_RETURN_UINT8 (2)
39 int
40 EIB_MC_Authorize_async (EIBConnection * con, uint8_t key[4])
42 uchar head[6];
43 if (!con)
45 errno = EINVAL;
46 return -1;
48 EIBSETTYPE (head, EIB_MC_AUTHORIZE);
49 memcpy (head + 2, key, 4);
50 if (_EIB_SendRequest (con, 6, head) == -1)
51 return -1;
52 con->complete = MC_Authorize_complete;
53 return 0;
56 int
57 EIB_MC_Authorize (EIBConnection * con, uint8_t key[4])
59 if (EIB_MC_Authorize_async (con, key) == -1)
60 return -1;
61 return EIBComplete (con);