1 /* gs2parser.h --- GS2 parser.
2 * Copyright (C) 2006 Simon Josefsson
4 * This file is part of GNU SASL Library.
6 * GNU SASL Library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
11 * GNU SASL Library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with GNU SASL Library; if not, write to the Free
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #include "gs2parser.h"
29 * 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
30 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
31 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32 * | client_qops | client_maxbuf |
33 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34 * | channel_binding_length |
35 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36 * |[client_cbqops]| [channel_binding_data] /
39 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43 gs2_parse_request (const char *request
, size_t reqlen
,
45 int *qop
, size_t *maxbuf
, size_t *cblen
,
46 int *cbqops
, char **cbdata
, char **authzid
)
58 (request
[1] << 16) & 0xFF0000 |
59 (request
[2] << 8) & 0xFF00 |
62 l
= (request
[4] << 24) & 0xFF000000 |
63 (request
[5] << 16) & 0xFF0000 |
64 (request
[6] << 8) & 0xFF00 |
67 if (l
> 0 && reqlen
== 8)
78 *cbdata
= &request
[9];
80 *authzid
= &request
[9] + l
;