Shuyi Chen | d7955ce | 2013-05-22 14:51:55 -0700 | [diff] [blame] | 1 | // Copyright (c) 2004 Brian Wellington (bwelling@xbill.org) |
| 2 | |
| 3 | package org.xbill.DNS; |
| 4 | |
| 5 | /** |
| 6 | * Route Through Record - lists a route preference and intermediate host. |
| 7 | * |
| 8 | * @author Brian Wellington |
| 9 | */ |
| 10 | |
| 11 | public class RTRecord extends U16NameBase { |
| 12 | |
| 13 | private static final long serialVersionUID = -3206215651648278098L; |
| 14 | |
| 15 | RTRecord() {} |
| 16 | |
| 17 | Record |
| 18 | getObject() { |
| 19 | return new RTRecord(); |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Creates an RT Record from the given data |
| 24 | * @param preference The preference of the route. Smaller numbers indicate |
| 25 | * more preferred routes. |
| 26 | * @param intermediateHost The domain name of the host to use as a router. |
| 27 | */ |
| 28 | public |
| 29 | RTRecord(Name name, int dclass, long ttl, int preference, |
| 30 | Name intermediateHost) |
| 31 | { |
| 32 | super(name, Type.RT, dclass, ttl, preference, "preference", |
| 33 | intermediateHost, "intermediateHost"); |
| 34 | } |
| 35 | |
| 36 | /** Gets the preference of the route. */ |
| 37 | public int |
| 38 | getPreference() { |
| 39 | return getU16Field(); |
| 40 | } |
| 41 | |
| 42 | /** Gets the host to use as a router. */ |
| 43 | public Name |
| 44 | getIntermediateHost() { |
| 45 | return getNameField(); |
| 46 | } |
| 47 | |
| 48 | } |