]> git.ipfire.org Git - thirdparty/strongswan.git/blob
cace18d5559ac260276eb006bc12e95406d5ebf6
[thirdparty/strongswan.git] /
1 /*
2 * Copyright (C) 2013 Tobias Brunner
3 * Copyright (C) 2012 Christoph Buehler
4 * Copyright (C) 2012 Patrick Loetscher
5 * Hochschule fuer Technik Rapperswil
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 */
17
18 package org.strongswan.android.logic.imc.attributes;
19
20 import org.strongswan.android.utils.BufferedByteWriter;
21
22 /**
23 * PA-TNC Product Information attribute (see section 4.2.2 of RFC 5792)
24 *
25 * 1 2 3
26 * 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
27 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
28 * | Product Vendor ID | Product ID |
29 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
30 * | Product ID | Product Name (Variable Length) |
31 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32 */
33 public class ProductInformationAttribute implements Attribute
34 {
35 private final String PRODUCT_NAME = "Android";
36 private final short PRODUCT_ID = 0;
37
38 @Override
39 public byte[] getEncoding()
40 {
41 BufferedByteWriter writer = new BufferedByteWriter();
42 writer.put24(PrivateEnterpriseNumber.GOOGLE.getValue());
43 writer.put16(PRODUCT_ID);
44 writer.put(PRODUCT_NAME.getBytes());
45 return writer.toByteArray();
46 }
47 }