/*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*-
 *
 * n4: A fast userspace NFSv4 server.
 * $Id: xdr.h,v 1.7 2001/07/19 03:53:19 mbp Exp $
 * 
 * Copyright (C) 2001 by Martin Pool <mbp@samba.org>
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */


                    /*
                     | I have also been a huge Unix fan ever since I
                     | realized that SCO was not Unix.           
                     |        -- Dennis Baker
                     */


/**
 * TODO: Put in panic_action code from Samba.
 */

/*
 * TODO: Perhaps add little enums to the buffers, which indicate what
 * XDR structure we're expecting to write to the buffer next.  Then,
 * before each function that writes stuff out, we can assert this is
 * the right value.  We don't want nested state, or a stack, so it
 * would have to deal only with top-level structures.
 */

/**
 * Global options for XDR encoding.
 **/
extern struct n4xdr_opts {
    size_t         max_fragment_size;
} n4xdr_opts;



inline static int PADDED(size_t l)
{
    return (l + 3) >> 2;
}



#define FROM_NET(x)       GUINT32_FROM_BE(x)
#define TO_NET(x)         GUINT32_TO_BE(x)
#define FROM_NET_HYPER(x) GUINT64_FROM_BE(x)
#define TO_NET_HYPER(x)   GUINT64_FROM_BE(x)
