1130803Smarcel/* 2130803Smarcel * Copyright (c) 1996 3130803Smarcel * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4130803Smarcel * 5130803Smarcel * Redistribution and use in source and binary forms, with or without 6130803Smarcel * modification, are permitted provided that the following conditions 7130803Smarcel * are met: 8130803Smarcel * 1. Redistributions of source code must retain the above copyright 9130803Smarcel * notice, this list of conditions and the following disclaimer. 10130803Smarcel * 2. Redistributions in binary form must reproduce the above copyright 11130803Smarcel * notice, this list of conditions and the following disclaimer in the 12130803Smarcel * documentation and/or other materials provided with the distribution. 13130803Smarcel * 3. All advertising materials mentioning features or use of this software 14130803Smarcel * must display the following acknowledgement: 15130803Smarcel * This product includes software developed by Bill Paul. 16130803Smarcel * 4. Neither the name of the author nor the names of any co-contributors 17130803Smarcel * may be used to endorse or promote products derived from this software 18130803Smarcel * without specific prior written permission. 19130803Smarcel * 20130803Smarcel * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 21130803Smarcel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22130803Smarcel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23130803Smarcel * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE 24130803Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25130803Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26130803Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27130803Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28130803Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29130803Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30130803Smarcel * SUCH DAMAGE. 31130803Smarcel */ 32130803Smarcel 33130803Smarcel#include <sys/cdefs.h> 34130803Smarcel__FBSDID("$FreeBSD: releng/10.2/usr.sbin/ypserv/yp_svc_udp.c 114601 2003-05-03 21:06:42Z obrien $"); 35130803Smarcel 36130803Smarcel#include <rpc/rpc.h> 37130803Smarcel#include <rpc/svc_dg.h> 38130803Smarcel#include "yp_extern.h" 39130803Smarcel 40130803Smarcel#define su_data(xprt) ((struct svc_dg_data *)(xprt->xp_p2)) 41130803Smarcel 42130803Smarcel/* 43130803Smarcel * We need to be able to manually set the transaction ID in the 44130803Smarcel * UDP transport handle, but the standard library offers us no way 45130803Smarcel * to do that. Hence we need this garbage. 46 */ 47 48unsigned long 49svcudp_get_xid(SVCXPRT *xprt) 50{ 51 struct svc_dg_data *su; 52 53 if (xprt == NULL) 54 return(0); 55 su = su_data(xprt); 56 return(su->su_xid); 57} 58 59unsigned long 60svcudp_set_xid(SVCXPRT *xprt, unsigned long xid) 61{ 62 struct svc_dg_data *su; 63 unsigned long old_xid; 64 65 if (xprt == NULL) 66 return(0); 67 su = su_data(xprt); 68 old_xid = su->su_xid; 69 su->su_xid = xid; 70 return(old_xid); 71} 72