ns_bsd_addr.c revision 355b4669e025ff377602b6fc7caaf30dbc218371
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*LINTLIBRARY*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <string.h>
#include <syslog.h>
#include <ns.h>
#include <list.h>
#include <misc.h>
/*
* Manipulate bsd_addr structures
*/
{
}
return (addr);
}
static char *
{
return (NULL);
return (NULL);
}
return (NULL);
}
>= sizeof (buf)) {
return (NULL);
}
}
}
string_to_bsd_addr(const char *string)
{
return (NULL);
}
}
static char *
list_to_string(const char **list)
{
return (NULL);
return (NULL);
}
return (NULL);
}
}
}
static char *
{
return (NULL);
return (NULL);
}
"internal_list_to_string:buffer overflow");
return (NULL);
}
}
}
char *
{
} else {
}
}
return (string);
}
void *
{
} else {
}
}
return (value);
}
static void
{
return;
}
break;
break;
}
}
/*
* This implements support for printer names that are fully resolvable
* on their own. These "complete" names are converted into a ns_printer_t
* structure containing an appropriate "bsdaddr" attribute. The supported
* formats are as follows:
* POSIX style (server:printer[:conformance]).
* This format is an adaptation of the format originally
* described in POSIX 1387.4. The POSIX draft has since been
* squashed, but this particular component lives on. The
* conformace field has been added to allow further identification
* of the the server.
*/
posix_name(const char *name)
{
if (*tmp == ':')
/* build the structure here */
"posix", list);
}
}
return (printer);
}
/*
* FUNCTION:
* int ns_bsd_addr_cmp(ns_bsd_addr_t *at, ns_bsd_addr_t *a2)
* INPUTS:
* ns_bsd_addr_t *a1 - a bsd addr
* ns_bsd_addr_t *21 - another bsd addr
* DESCRIPTION:
* This functions compare 2 bsd_addr structures to determine if the
* information in them is the same.
*/
static int
{
int rc;
return (1);
return (rc);
}
/*
* FUNCTION: ns_bsd_addr_cmp_local()
*
* DESCRIPTION: This function compares 2 bsd_addr structures to determine if
* the information in them is the same. It destinquishes between
* real printer names and alias names while doing the compare.
*
* INPUTS: ns_bsd_addr_t *a1 - a bsd addr
* ns_bsd_addr_t *21 - another bsd addr
*/
static int
{
int rc;
{
return (1);
}
{
return (rc);
}
{
}
if (rc == 0)
{
/*
* The printer's real names are the same, but now check if
* their local names (alias) are the same.
*/
}
return (rc);
} /* ns_bsd_addr_cmp_local */
/*
* FUNCTION:
* ns_bsd_addr_t *ns_bsd_addr_get_name(char *name)
* INPUTS:
* char *name - name of printer to get address for
* OUTPUTS:
* ns_bsd_addr_t *(return) - the address of the printer
* DESCRIPTION:
* This function will get the BSD address of the printer specified.
* it fills in the printer name if none is specified in the "name service"
* as a convenience to calling functions.
*/
ns_bsd_addr_get_name(char *name)
{
/*
* if the name given is not the same as that in the
* pname field otherwise duplicate the real printer
* name
*/
} else {
}
}
}
return (addr);
}
/*
* FUNCTION:
* ns_bsd_addr_t **ns_bsd_addr_get_list()
* OUTPUT:
* ns_bsd_addr_t **(return) - a list of bsd addresses for all printers
* in all "name services"
* DESCRIPTION:
* This function will gather a list of all printer addresses in all
* of the "name services". All redundancy is removed.
*/
{
continue;
}
list =
else
if (unique == LOCAL_UNIQUE)
list =
else
(void *)addr);
{
/*
* Include any alias names that belong to the printer
*/
if ((addr =
{
{
}
}
{
list = (ns_bsd_addr_t **)
list_append_unique((void **)list,
}
else
if (unique == LOCAL_UNIQUE)
{
list = (ns_bsd_addr_t **)
list_append_unique((void **)list,
(void *)addr,
}
else
{
list = (ns_bsd_addr_t **)
}
}
}
return (list);
}
/*
* FUNCTION:
* ns_bsd_addr_t **ns_bsd_addr_get_list()
* OUTPUT:
* ns_bsd_addr_t **(return) - a list of bsd addresses for "_all" printers
* in the "name service"
* DESCRIPTION:
* This function will use the "_all" entry to find a list of printers and
* addresses. The "default" printer is also added to the list.
* All redundancy is removed.
*/
{
char **printers;
(void *)ns_bsd_addr_get_name(def));
return (ns_bsd_addr_get_list(unique));
list =
else
(void *)addr);
}
return (list);
}
{
return (addr);
}
}
return (NULL);
}