View Javadoc
1   /*
2    * Copyright 2024 Michael Osipov
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.michaelo.tomcat.pac;
17  
18  /**
19   * A class representing the <a href=
20   * "https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/94a16bb6-c610-4cb9-8db6-26f15f560061">{@code RPC_UNICODE_STRING}</a>
21   * structure from MS-DTYP.
22   */
23  public class RpcUnicodeString {
24  
25  	private long length;
26  	private long maximumLength;
27  	private long pointer;
28  
29  	/**
30  	 * Constructs a RPC Unicode string.
31  	 *
32  	 * @throws IllegalArgumentException
33  	 *             if {@code maximumLength} is smaller than {@code length}
34  	 */
35  	public RpcUnicodeString(long length, long maximumLength, long pointer) {
36  		if (maximumLength < length)
37  			throw new IllegalArgumentException(
38  					"RPC_UNICODE_STRING maximumLength is smaller than length: " + maximumLength
39  							+ " < " + length);
40  
41  		this.length = length;
42  		this.maximumLength = maximumLength;
43  		this.pointer = pointer;
44  	}
45  
46  	public long getLength() {
47  		return length;
48  	}
49  
50  	public long getMaximumLength() {
51  		return maximumLength;
52  	}
53  
54  	public long getPointer() {
55  		return pointer;
56  	}
57  
58  }