srvrecord.java
来自「linux下建立JAVA虚拟机的源码KAFFE」· Java 代码 · 共 112 行
JAVA
112 行
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)package org.xbill.DNS;import java.io.*;/** * Server Selection Record - finds hosts running services in a domain. An * SRV record will normally be named <service>.<protocol>.domain - an * example would be http.tcp.example.com (if HTTP used SRV records) * * @author Brian Wellington */public class SRVRecord extends Record {private int priority, weight, port;private Name target;SRVRecord() {}RecordgetObject() { return new SRVRecord();}/** * Creates an SRV Record from the given data * @param priority The priority of this SRV. Records with lower priority * are preferred. * @param weight The weight, used to select between records at the same * priority. * @param port The TCP/UDP port that the service uses * @param target The host running the service */publicSRVRecord(Name name, int dclass, long ttl, int priority, int weight, int port, Name target){ super(name, Type.SRV, dclass, ttl); this.priority = checkU16("priority", priority); this.weight = checkU16("weight", weight); this.port = checkU16("port", port); this.target = checkName("target", target);}voidrrFromWire(DNSInput in) throws IOException { priority = in.readU16(); weight = in.readU16(); port = in.readU16(); target = new Name(in);}voidrdataFromString(Tokenizer st, Name origin) throws IOException { priority = st.getUInt16(); weight = st.getUInt16(); port = st.getUInt16(); target = st.getName(origin);}/** Converts rdata to a String */StringrrToString() { StringBuffer sb = new StringBuffer(); sb.append(priority + " "); sb.append(weight + " "); sb.append(port + " "); sb.append(target); return sb.toString();}/** Returns the priority */public intgetPriority() { return priority;}/** Returns the weight */public intgetWeight() { return weight;}/** Returns the port that the service runs on */public intgetPort() { return port;}/** Returns the host running that the service */public NamegetTarget() { return target;}voidrrToWire(DNSOutput out, Compression c, boolean canonical) { out.writeU16(priority); out.writeU16(weight); out.writeU16(port); target.toWire(out, null, canonical);}public NamegetAdditionalName() { return target;}}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?