2 * Copyright (C) 2013 Tobias Brunner
3 * Copyright (C) 2012 Christoph Buehler
4 * Copyright (C) 2012 Patrick Loetscher
5 * Hochschule fuer Technik Rapperswil
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>.
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
18 package org.strongswan.android.logic.imc.attributes;
20 import org.strongswan.android.utils.BufferedByteWriter;
23 * PA-TNC String Version attribute (see section 4.2.4 of RFC 5792)
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 * | Version Len | Product Version Number (Variable Length) |
29 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
30 * | Build Num Len | Internal Build Number (Variable Length) |
31 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32 * | Config. Len | Configuration Version Number (Variable Length)|
33 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
35 public class StringVersionAttribute implements Attribute
37 private String mVersionNumber;
38 private String mBuildNumber;
41 * Set the product version number
42 * @param version version number
44 public void setProductVersionNumber(String version)
46 this.mVersionNumber = version;
50 * Set the internal build number
51 * @param build build number
53 public void setInternalBuildNumber(String build)
55 this.mBuildNumber = build;
59 public byte[] getEncoding()
61 BufferedByteWriter writer = new BufferedByteWriter();
62 writer.putLen8(mVersionNumber.getBytes());
63 writer.putLen8(mBuildNumber.getBytes());
64 /* we don't provide a configuration number */
66 return writer.toByteArray();