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