xref: /illumos-gate/usr/src/lib/print/libpapi-lpd/common/library.c (revision 201ceb75ab95f9bf1f42ea1dc9ab363b43ba47cf)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  *
26  */
27 
28 /* $Id: library.c 146 2006-03-24 00:26:54Z njacobs $ */
29 
30 #include <stdlib.h>
31 #include <stdio.h>
32 #include <stdarg.h>
33 #include <string.h>
34 #include <alloca.h>
35 #include <libintl.h>
36 #include <papi_impl.h>
37 
38 static char *calls[] = {
39 	/* Attribute Calls */
40 	"papiAttributeListAdd",
41 	"papiAttributeListAddBoolean", "papiAttributeListAddCollection",
42 	"papiAttributeListAddDatetime", "papiAttributeListAddInteger",
43 	"papiAttributeListAddMetadata", "papiAttributeListAddRange",
44 	"papiAttributeListAddResolution", "papiAttributeListAddString",
45 	"papiAttributeListDelete",
46 	"papiAttributeListGetValue", "papiAttributeListGetNext",
47 	"papiAttributeListFind",
48 	"papiAttributeListGetBoolean", "papiAttributeListGetCollection",
49 	"papiAttributeListGetDatetime", "papiAttributeListGetInteger",
50 	"papiAttributeListGetMetadata", "papiAttributeListGetRange",
51 	"papiAttributeListGetResolution", "papiAttributeListGetString",
52 	"papiAttributeListFromString", "papiAttributeListToString",
53 	"papiAttributeListFree",
54 	/* Job Calls */
55 	"papiJobSubmit", "papiJobSubmitByReference",
56 	"papiJobStreamOpen", "papiJobStreamWrite", "papiJobStreamClose",
57 	"papiJobQuery", "papiJobCancel",
58 	"papiJobGetAttributeList", "papiJobGetId", "papiJobGetPrinterName",
59 	"papiJobFree", "papiJobListFree",
60 	/* Printer Calls */
61 	"papiPrinterQuery", "papiPrinterPurgeJobs", "papiPrinterListJobs",
62 	"papiPrinterGetAttributeList", "papiPrinterFree",
63 	/* Service Calls */
64 	"papiServiceCreate", "papiServiceDestroy",
65 	"papiServiceGetStatusMessage",
66 	/* Misc Calls */
67 	"papiStatusString",
68 	"papiLibrarySupportedCall", "papiLibrarySupportedCalls",
69 	NULL
70 };
71 
72 char **
73 papiLibrarySupportedCalls()
74 {
75 	return (calls);
76 }
77 
78 char
79 papiLibrarySupportedCall(char *name)
80 {
81 	int i;
82 
83 	for (i = 0; calls[i] != NULL; i++)
84 		if (strcmp(name, calls[i]) == 0)
85 			return (PAPI_TRUE);
86 
87 	return (PAPI_FALSE);
88 }
89