1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 21 package org.apache.directory.server.dns.io.encoder; 22 23 24 import org.apache.directory.server.dns.messages.ResourceRecord; 25 import org.apache.directory.server.dns.store.DnsAttribute; 26 import org.apache.mina.common.ByteBuffer; 27 28 29 /** 30 * 3.3.9. MX RDATA format 31 * 32 * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 33 * | PREFERENCE | 34 * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 35 * / EXCHANGE / 36 * / / 37 * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 38 * 39 * where: 40 * 41 * PREFERENCE A 16 bit integer which specifies the preference given to 42 * this RR among others at the same owner. Lower values 43 * are preferred. 44 * 45 * EXCHANGE A <domain-name> which specifies a host willing to act as 46 * a mail exchange for the owner name. 47 * 48 * MX records cause type A additional section processing for the host 49 * specified by EXCHANGE. The use of MX RRs is explained in detail in 50 * [RFC-974]. 51 * 52 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 53 * @version $Rev: 507387 $, $Date: 2007-02-14 05:54:05 +0100 (Mi, 14 Feb 2007) $ 54 */ 55 public class MailExchangeRecordEncoder extends ResourceRecordEncoder 56 { 57 protected void putResourceRecordData( ByteBuffer byteBuffer, ResourceRecord record ) 58 { 59 byteBuffer.putShort( Short.parseShort( record.get( DnsAttribute.MX_PREFERENCE ) ) ); 60 putDomainName( byteBuffer, record.get( DnsAttribute.DOMAIN_NAME ) ); 61 } 62 }