/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <stddef.h>
#include "libilb.h"
#include "libilb_impl.h"
enum which_tbl {
};
/* The common function to show kernel info. */
enum which_tbl);
/*
* To get the ILB NAT table.
*
* buf: The buffer to return the NAT table entries.
* num: The caller sets it to the number of ilb_nat_info_t entries buf can
* hold. On return, it contains the actual number of entries put in buf.
* end: The caller sets it to B_TRUE if it only wants at most num entries to
* be returned. The transaction to ilbd will be termianted when this
* call returns.
* The caller sets it to B_FALSE if it intends to get the whole table.
* If the whole table has more than num entries, the caller can call
* this function again to retrieve the rest of the table.
* On return, end is set to B_TRUE if end of table is reached; B_FALSE
* if there are still remaining entries.
*/
{
}
/*
* To get the ILB persistent entry table.
*
* buf: The buffer to return the persistent table entries.
* num: The caller sets it to the number of ilb_persist_info_t entries buf can
* hold. On return, it contains the actual number of entries put in buf.
* end: The caller sets it to B_TRUE if it only wants at most num entries to
* be returned. The transaction to ilbd will be termianted when this
* call returns.
* The caller sets it to B_FALSE if it intends to get the whole table.
* If the whole table has more than num entries, the caller can call
* this function again to retrieve the rest of the table.
* On return, end is set to B_TRUE if end of table is reached; B_FALSE
* if there are still remaining entries.
*/
{
}
/*
* The function doing the work... The tbl parameter determines whith table
* to show.
*/
static ilb_status_t
{
if (*num == 0)
return (ILB_STATUS_EINVAL);
return (ILB_STATUS_ENOMEM);
/*
* Need to allocate a receive buffer and then copy the buffer
* content to the passed in buf. The reason is that the
* communication to ilbd is message based and the protocol
* includes a header in the reply. We need to remove this header
* from the message, hence the copying...
*/
entry_sz = sizeof (ilb_nat_info_t);
else
entry_sz = sizeof (ilb_persist_info_t);
sizeof (ilb_show_info_t);
return (ILB_STATUS_ENOMEM);
}
else
cur_num = 0;
do {
tmp_rbufsz = rbufsz;
if (rc != ILB_STATUS_OK)
goto out;
goto out;
}
/*
* Buffer is filled, regardless of this is the end of table or
* not, we need to stop.
*/
break;
/* Try to fill in the rest. */
/* End of transaction, let the caller know. */
} else {
/* The user wants to terminate the transaction */
if (*end) {
tmp_rbufsz = rbufsz;
}
}
out:
return (rc);
}