10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7298SMark.J.Nelson@Sun.COM * Common Development and Distribution License (the "License"). 6*7298SMark.J.Nelson@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 220Sstevel@tonic-gate * Copyright (c) 1999 by Sun Microsystems, Inc. 230Sstevel@tonic-gate * All rights reserved. 240Sstevel@tonic-gate * 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate // SrvLocMsgImpl.java: SrvLocMsg implementation. 280Sstevel@tonic-gate // Author: James Kempf 290Sstevel@tonic-gate // Created On: Tue Sep 15 10:06:27 1998 300Sstevel@tonic-gate // Last Modified By: James Kempf 310Sstevel@tonic-gate // Last Modified On: Sun Oct 11 17:11:13 1998 320Sstevel@tonic-gate // Update Count: 8 330Sstevel@tonic-gate // 340Sstevel@tonic-gate 350Sstevel@tonic-gate package com.sun.slp; 360Sstevel@tonic-gate 370Sstevel@tonic-gate import java.util.*; 380Sstevel@tonic-gate 390Sstevel@tonic-gate /** 400Sstevel@tonic-gate * The SrvLocMsgImpl class is the base class for all SLPv2 side SrvLocMsg 410Sstevel@tonic-gate * implementations. 420Sstevel@tonic-gate * 430Sstevel@tonic-gate * @author James Kempf 440Sstevel@tonic-gate */ 450Sstevel@tonic-gate 460Sstevel@tonic-gate abstract class SrvLocMsgImpl extends Object implements SrvLocMsg { 470Sstevel@tonic-gate 480Sstevel@tonic-gate protected SrvLocHeader hdr = null; 490Sstevel@tonic-gate 500Sstevel@tonic-gate // For creating outgoing messages. 510Sstevel@tonic-gate SrvLocMsgImpl()520Sstevel@tonic-gate SrvLocMsgImpl() {} 530Sstevel@tonic-gate 540Sstevel@tonic-gate // Check and set the header. 550Sstevel@tonic-gate SrvLocMsgImpl(SrvLocHeader hdr, int functionCode)560Sstevel@tonic-gate SrvLocMsgImpl(SrvLocHeader hdr, int functionCode) 570Sstevel@tonic-gate throws ServiceLocationException { 580Sstevel@tonic-gate 590Sstevel@tonic-gate if (hdr.functionCode != functionCode) { 600Sstevel@tonic-gate throw 610Sstevel@tonic-gate new ServiceLocationException( 620Sstevel@tonic-gate ServiceLocationException.NETWORK_ERROR, 630Sstevel@tonic-gate "wrong_reply_type", 640Sstevel@tonic-gate new Object[] {new Integer(hdr.functionCode)}); 650Sstevel@tonic-gate } 660Sstevel@tonic-gate 670Sstevel@tonic-gate this.hdr = hdr; 680Sstevel@tonic-gate 690Sstevel@tonic-gate } 700Sstevel@tonic-gate 710Sstevel@tonic-gate // Return the header. 720Sstevel@tonic-gate getHeader()730Sstevel@tonic-gate public SrvLocHeader getHeader() { 740Sstevel@tonic-gate return hdr; 750Sstevel@tonic-gate } 760Sstevel@tonic-gate 770Sstevel@tonic-gate // Return the error code, via the header. 780Sstevel@tonic-gate getErrorCode()790Sstevel@tonic-gate public short getErrorCode() { 800Sstevel@tonic-gate return hdr.errCode; 810Sstevel@tonic-gate } 820Sstevel@tonic-gate 830Sstevel@tonic-gate } 84