xref: /illumos-gate/usr/src/cmd/lp/lib/papi/library.c (revision 59d65d3175825093531e82f44269d948ed510a00)
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 /*LINTLIBRARY*/
29 
30 #include <stdio.h>
31 #include <string.h>
32 #include <papi.h>
33 
34 static char *calls[] = {
35 	/* Attribute Calls */
36 	"papiAttributeListAddValue",
37 	"papiAttributeListAddBoolean", "papiAttributeListAddCollection",
38 	"papiAttributeListAddDatetime", "papiAttributeListAddInteger",
39 	"papiAttributeListAddMetadata", "papiAttributeListAddRange",
40 	"papiAttributeListAddResolution", "papiAttributeListAddString",
41 	"papiAttributeListDelete",
42 	"papiAttributeListGetValue", "papiAttributeListGetNext",
43 	"papiAttributeListFind",
44 	"papiAttributeListGetBoolean", "papiAttributeListGetCollection",
45 	"papiAttributeListGetDatetime", "papiAttributeListGetInteger",
46 	"papiAttributeListGetMetadata", "papiAttributeListGetRange",
47 	"papiAttributeListGetResolution", "papiAttributeListGetString",
48 	"papiAttributeListFromString", "papiAttributeListToString",
49 	"papiAttributeListFree",
50 	/* Job Calls */
51 	"papiJobSubmit", "papiJobSubmitByReference", "papiJobValidate",
52 	"papiJobStreamOpen", "papiJobStreamWrite", "papiJobStreamClose",
53 	"papiJobQuery", "papiJobModify", "papiJobCancel", "papiJobPromote",
54 	"papiJobGetAttributeList", "papiJobGetId", "papiJobGetPrinterName",
55 	"papiJobFree", "papiJobListFree",
56 	"papiJobHold", "papiJobRelease",
57 	/* Printer Calls */
58 	"papiPrintersList", "papiPrinterQuery", "papiPrinterModify",
59 	"papiPrinterAdd", "papiPrinterRemove",
60 	"papiPrinterPause", "papiPrinterResume",
61 	"papiPrinterDisable", "papiPrinterEnable",
62 	"papiPrinterPurgeJobs", "papiPrinterListJobs",
63 	"papiPrinterGetAttributeList",
64 	"papiPrinterFree", "papiPrinterListFree",
65 	/* Service Calls */
66 	"papiServiceCreate", "papiServiceDestroy",
67 	"papiServiceGetAppData",
68 	"papiServiceGetEncryption", "papiServiceGetPassword",
69 	"papiServiceGetServiceName", "papiServiceGetUserName",
70 	"papiServiceSetAppData", "papiServiceSetAuthCB",
71 	"papiServiceSetEncryption", "papiServiceSetPassword",
72 	"papiServiceSetUserName",
73 	"papiServiceGetAttributeList", "papiServiceGetStatusMessage",
74 	/* Misc Calls */
75 	"papiStatusString",
76 	"papiLibrarySupportedCall", "papiLibrarySupportedCalls",
77 	NULL
78 };
79 
80 char **
81 papiLibrarySupportedCalls()
82 {
83 	return (calls);
84 }
85 
86 char
87 papiLibrarySupportedCall(const char *name)
88 {
89 	int i;
90 
91 	for (i = 0; calls[i] != NULL; i++)
92 		if (strcmp(name, calls[i]) == 0)
93 			return (PAPI_TRUE);
94 
95 	return (PAPI_FALSE);
96 }
97