120818Swpaul/*
220818Swpaul * Copyright (c) 1996
320818Swpaul *	Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.
420818Swpaul *
520818Swpaul * Redistribution and use in source and binary forms, with or without
620818Swpaul * modification, are permitted provided that the following conditions
720818Swpaul * are met:
820818Swpaul * 1. Redistributions of source code must retain the above copyright
920818Swpaul *    notice, this list of conditions and the following disclaimer.
1020818Swpaul * 2. Redistributions in binary form must reproduce the above copyright
1120818Swpaul *    notice, this list of conditions and the following disclaimer in the
1220818Swpaul *    documentation and/or other materials provided with the distribution.
1320818Swpaul * 3. All advertising materials mentioning features or use of this software
1420818Swpaul *    must display the following acknowledgement:
1520818Swpaul *	This product includes software developed by Bill Paul.
1620818Swpaul * 4. Neither the name of the author nor the names of any co-contributors
1720818Swpaul *    may be used to endorse or promote products derived from this software
1820818Swpaul *    without specific prior written permission.
1920818Swpaul *
2020818Swpaul * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
2120818Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2220818Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2320818Swpaul * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE
2420818Swpaul * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2520818Swpaul * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2620818Swpaul * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2720818Swpaul * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2820818Swpaul * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2920818Swpaul * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3020818Swpaul * SUCH DAMAGE.
3120818Swpaul */
3220818Swpaul
33114601Sobrien#include <sys/cdefs.h>
34114601Sobrien__FBSDID("$FreeBSD$");
3530827Scharnier
3620818Swpaul#include <rpc/rpc.h>
3774610Swpaul#include <rpc/svc_dg.h>
3820818Swpaul#include "yp_extern.h"
3920818Swpaul
4074610Swpaul#define su_data(xprt)	((struct svc_dg_data *)(xprt->xp_p2))
4120818Swpaul
4220818Swpaul/*
4320818Swpaul * We need to be able to manually set the transaction ID in the
4420818Swpaul * UDP transport handle, but the standard library offers us no way
4520818Swpaul * to do that. Hence we need this garbage.
4620818Swpaul */
4720818Swpaul
4820818Swpaulunsigned long
4990298Sdessvcudp_get_xid(SVCXPRT *xprt)
5020818Swpaul{
5174610Swpaul	struct svc_dg_data *su;
5220818Swpaul
5320818Swpaul	if (xprt == NULL)
5420818Swpaul		return(0);
5520818Swpaul	su = su_data(xprt);
5620818Swpaul	return(su->su_xid);
5720818Swpaul}
5820818Swpaul
5920818Swpaulunsigned long
6090298Sdessvcudp_set_xid(SVCXPRT *xprt, unsigned long xid)
6120818Swpaul{
6274610Swpaul	struct svc_dg_data *su;
6320818Swpaul	unsigned long old_xid;
6420818Swpaul
6520818Swpaul	if (xprt == NULL)
6620818Swpaul		return(0);
6720818Swpaul	su = su_data(xprt);
6820818Swpaul	old_xid = su->su_xid;
6920818Swpaul	su->su_xid = xid;
7020818Swpaul	return(old_xid);
7120818Swpaul}
72