145916cd2Sjpk /* 245916cd2Sjpk * CDDL HEADER START 345916cd2Sjpk * 445916cd2Sjpk * The contents of this file are subject to the terms of the 545916cd2Sjpk * Common Development and Distribution License (the "License"). 645916cd2Sjpk * You may not use this file except in compliance with the License. 745916cd2Sjpk * 845916cd2Sjpk * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 945916cd2Sjpk * or http://www.opensolaris.org/os/licensing. 1045916cd2Sjpk * See the License for the specific language governing permissions 1145916cd2Sjpk * and limitations under the License. 1245916cd2Sjpk * 1345916cd2Sjpk * When distributing Covered Code, include this CDDL HEADER in each 1445916cd2Sjpk * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1545916cd2Sjpk * If applicable, add the following below this CDDL HEADER, with the 1645916cd2Sjpk * fields enclosed by brackets "[]" replaced with your own identifying 1745916cd2Sjpk * information: Portions Copyright [yyyy] [name of copyright owner] 1845916cd2Sjpk * 1945916cd2Sjpk * CDDL HEADER END 2045916cd2Sjpk */ 2145916cd2Sjpk /* 22*e9d1e0cdSgww * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 2345916cd2Sjpk * Use is subject to license terms. 2445916cd2Sjpk */ 2545916cd2Sjpk 2645916cd2Sjpk #ifndef _LABELD_H 2745916cd2Sjpk #define _LABELD_H 2845916cd2Sjpk 2945916cd2Sjpk #pragma ident "%Z%%M% %I% %E% SMI" 3045916cd2Sjpk 3145916cd2Sjpk #include <sys/types.h> 3245916cd2Sjpk #include <tsol/label.h> 3345916cd2Sjpk #include <sys/tsol/label_macro.h> 3445916cd2Sjpk 3545916cd2Sjpk #ifdef __cplusplus 3645916cd2Sjpk extern "C" { 3745916cd2Sjpk #endif 3845916cd2Sjpk 3945916cd2Sjpk /* 4045916cd2Sjpk * Definitions for the call parameters for the door-based label 4145916cd2Sjpk * translation service. 4245916cd2Sjpk */ 4345916cd2Sjpk 4445916cd2Sjpk #define BUFSIZE 4096 4545916cd2Sjpk 4645916cd2Sjpk #define DOOR_PATH "/var/tsol/doors/" 4745916cd2Sjpk #define DOOR_NAME "labeld" 4845916cd2Sjpk #define COOKIE (void *)0x6c616264 /* "labd" */ 4945916cd2Sjpk 5045916cd2Sjpk /* Op codes */ 5145916cd2Sjpk 5245916cd2Sjpk /* Labeld Commands */ 5345916cd2Sjpk 5445916cd2Sjpk #define LABELDNULL 1 5545916cd2Sjpk 5645916cd2Sjpk /* Miscellaneous */ 5745916cd2Sjpk 5845916cd2Sjpk #define BLINSET 10 5945916cd2Sjpk #define BSLVALID 11 6045916cd2Sjpk #define BILVALID 12 6145916cd2Sjpk #define BCLEARVALID 13 6245916cd2Sjpk #define LABELINFO 14 6345916cd2Sjpk #define LABELVERS 15 6445916cd2Sjpk #define BLTOCOLOR 16 6545916cd2Sjpk 6645916cd2Sjpk /* Binary to String Label Translation */ 6745916cd2Sjpk 6845916cd2Sjpk #define BSLTOS 23 6945916cd2Sjpk #define BCLEARTOS 25 7045916cd2Sjpk 7145916cd2Sjpk /* String to Binary Label Translation */ 7245916cd2Sjpk 7345916cd2Sjpk #define STOBSL 31 7445916cd2Sjpk #define STOBCLEAR 33 7545916cd2Sjpk 7645916cd2Sjpk /* 7745916cd2Sjpk * Dimming List Routines 7845916cd2Sjpk * Contract private for label builders 7945916cd2Sjpk */ 8045916cd2Sjpk 8145916cd2Sjpk #define BSLCVT 40 8245916cd2Sjpk #define BCLEARCVT 42 8345916cd2Sjpk #define LABELFIELDS 43 8445916cd2Sjpk #define UDEFS 44 8545916cd2Sjpk 8645916cd2Sjpk #define GETFLABEL 45 8745916cd2Sjpk #define SETFLABEL 46 8845916cd2Sjpk #define ZCOPY 47 8945916cd2Sjpk 9045916cd2Sjpk /* NEW LABELS */ 9145916cd2Sjpk /* DIA printer banner labels */ 9245916cd2Sjpk 9345916cd2Sjpk #define PR_CAVEATS 101 9445916cd2Sjpk #define PR_CHANNELS 102 9545916cd2Sjpk #define PR_LABEL 103 9645916cd2Sjpk #define PR_TOP 104 9745916cd2Sjpk 9845916cd2Sjpk /* DIA label to string */ 9945916cd2Sjpk 10045916cd2Sjpk #define LTOS 105 10145916cd2Sjpk 10245916cd2Sjpk /* DIA string to label */ 10345916cd2Sjpk 10445916cd2Sjpk #define STOL 106 10545916cd2Sjpk 10645916cd2Sjpk /* Structures */ 10745916cd2Sjpk 10845916cd2Sjpk typedef uint_t bufp_t; /* offset into buf[] in/out string buffer */ 10945916cd2Sjpk 11045916cd2Sjpk /* Null call */ 11145916cd2Sjpk 11245916cd2Sjpk typedef struct { 11345916cd2Sjpk int null; 11445916cd2Sjpk } null_call_t; 11545916cd2Sjpk 11645916cd2Sjpk typedef struct { 11745916cd2Sjpk int null; 11845916cd2Sjpk } null_ret_t; 11945916cd2Sjpk 12045916cd2Sjpk /* Miscellaneous interfaces */ 12145916cd2Sjpk 12245916cd2Sjpk typedef struct { 12345916cd2Sjpk bslabel_t label; 12445916cd2Sjpk int type; 12545916cd2Sjpk } inset_call_t; 12645916cd2Sjpk 12745916cd2Sjpk typedef struct { 12845916cd2Sjpk int inset; 12945916cd2Sjpk } inset_ret_t; 13045916cd2Sjpk 13145916cd2Sjpk typedef struct { 13245916cd2Sjpk bslabel_t label; 13345916cd2Sjpk } slvalid_call_t; 13445916cd2Sjpk 13545916cd2Sjpk typedef struct { 13645916cd2Sjpk int valid; 13745916cd2Sjpk } slvalid_ret_t; 13845916cd2Sjpk 13945916cd2Sjpk typedef struct { 14045916cd2Sjpk bclear_t clear; 14145916cd2Sjpk } clrvalid_call_t; 14245916cd2Sjpk 14345916cd2Sjpk typedef struct { 14445916cd2Sjpk int valid; 14545916cd2Sjpk } clrvalid_ret_t; 14645916cd2Sjpk 14745916cd2Sjpk typedef struct { 14845916cd2Sjpk int null; 14945916cd2Sjpk } info_call_t; 15045916cd2Sjpk 15145916cd2Sjpk typedef struct { 15245916cd2Sjpk struct label_info info; 15345916cd2Sjpk } info_ret_t; 15445916cd2Sjpk 15545916cd2Sjpk typedef struct { 15645916cd2Sjpk int null; 15745916cd2Sjpk } vers_call_t; 15845916cd2Sjpk 15945916cd2Sjpk typedef struct { 16045916cd2Sjpk char vers[BUFSIZE]; 16145916cd2Sjpk } vers_ret_t; 16245916cd2Sjpk 16345916cd2Sjpk typedef struct { 16445916cd2Sjpk blevel_t label; 16545916cd2Sjpk } color_call_t; 16645916cd2Sjpk 16745916cd2Sjpk typedef struct { 16845916cd2Sjpk char color[BUFSIZE]; 16945916cd2Sjpk } color_ret_t; 17045916cd2Sjpk 17145916cd2Sjpk /* Binary Label to String interfaces */ 17245916cd2Sjpk 17345916cd2Sjpk typedef struct { 17445916cd2Sjpk bslabel_t label; 17545916cd2Sjpk uint_t flags; 17645916cd2Sjpk } bsltos_call_t; 17745916cd2Sjpk 17845916cd2Sjpk typedef struct { 17945916cd2Sjpk char slabel[BUFSIZE]; 18045916cd2Sjpk } bsltos_ret_t; 18145916cd2Sjpk 18245916cd2Sjpk typedef struct { 18345916cd2Sjpk bclear_t clear; 18445916cd2Sjpk uint_t flags; 18545916cd2Sjpk } bcleartos_call_t; 18645916cd2Sjpk 18745916cd2Sjpk typedef struct { 18845916cd2Sjpk char cslabel[BUFSIZE]; 18945916cd2Sjpk } bcleartos_ret_t; 19045916cd2Sjpk 19145916cd2Sjpk /* String to Binary Label interfaces */ 19245916cd2Sjpk 19345916cd2Sjpk typedef struct { 19445916cd2Sjpk bslabel_t label; 19545916cd2Sjpk uint_t flags; 19645916cd2Sjpk char string[BUFSIZE]; 19745916cd2Sjpk } stobsl_call_t; 19845916cd2Sjpk 19945916cd2Sjpk typedef struct { 20045916cd2Sjpk bslabel_t label; 20145916cd2Sjpk } stobsl_ret_t; 20245916cd2Sjpk 20345916cd2Sjpk typedef struct { 20445916cd2Sjpk bclear_t clear; 20545916cd2Sjpk uint_t flags; 20645916cd2Sjpk char string[BUFSIZE]; 20745916cd2Sjpk } stobclear_call_t; 20845916cd2Sjpk 20945916cd2Sjpk typedef struct { 21045916cd2Sjpk bclear_t clear; 21145916cd2Sjpk } stobclear_ret_t; 21245916cd2Sjpk 21345916cd2Sjpk /* 21445916cd2Sjpk * The following Dimming List and Miscellaneous interfaces 21545916cd2Sjpk * implement contract private interfaces for the label builder 21645916cd2Sjpk * interfaces. 21745916cd2Sjpk */ 21845916cd2Sjpk 21945916cd2Sjpk /* Dimming List interfaces */ 22045916cd2Sjpk 22145916cd2Sjpk typedef struct { 22245916cd2Sjpk bslabel_t label; 22345916cd2Sjpk brange_t bounds; 22445916cd2Sjpk uint_t flags; 22545916cd2Sjpk } bslcvt_call_t; 22645916cd2Sjpk 22745916cd2Sjpk typedef struct { 22845916cd2Sjpk bufp_t string; 22945916cd2Sjpk bufp_t dim; 23045916cd2Sjpk bufp_t lwords; 23145916cd2Sjpk bufp_t swords; 23245916cd2Sjpk size_t d_len; 23345916cd2Sjpk size_t l_len; 23445916cd2Sjpk size_t s_len; 23545916cd2Sjpk int first_comp; 23645916cd2Sjpk int first_mark; 23745916cd2Sjpk char buf[BUFSIZE]; 23845916cd2Sjpk } cvt_ret_t; 23945916cd2Sjpk 24045916cd2Sjpk typedef cvt_ret_t bslcvt_ret_t; 24145916cd2Sjpk 24245916cd2Sjpk typedef struct { 24345916cd2Sjpk bclear_t clear; 24445916cd2Sjpk brange_t bounds; 24545916cd2Sjpk uint_t flags; 24645916cd2Sjpk } bclearcvt_call_t; 24745916cd2Sjpk 24845916cd2Sjpk typedef cvt_ret_t bclearcvt_ret_t; 24945916cd2Sjpk 25045916cd2Sjpk /* Miscellaneous interfaces */ 25145916cd2Sjpk 25245916cd2Sjpk typedef struct { 25345916cd2Sjpk int null; 25445916cd2Sjpk } fields_call_t; 25545916cd2Sjpk 25645916cd2Sjpk typedef struct { 25745916cd2Sjpk bufp_t classi; 25845916cd2Sjpk bufp_t compsi; 25945916cd2Sjpk bufp_t marksi; 26045916cd2Sjpk char buf[BUFSIZE]; 26145916cd2Sjpk } fields_ret_t; 26245916cd2Sjpk 26345916cd2Sjpk typedef struct { 26445916cd2Sjpk int null; 26545916cd2Sjpk } udefs_call_t; 26645916cd2Sjpk 26745916cd2Sjpk typedef struct { 26845916cd2Sjpk bslabel_t sl; 26945916cd2Sjpk bclear_t clear; 27045916cd2Sjpk } udefs_ret_t; 27145916cd2Sjpk 27245916cd2Sjpk typedef struct { 27345916cd2Sjpk bslabel_t sl; 27445916cd2Sjpk char pathname[BUFSIZE]; 27545916cd2Sjpk } setfbcl_call_t; 27645916cd2Sjpk 27745916cd2Sjpk typedef struct { 27845916cd2Sjpk int status; 27945916cd2Sjpk } setfbcl_ret_t; 28045916cd2Sjpk 28145916cd2Sjpk typedef struct { 28245916cd2Sjpk bslabel_t src_win_sl; 28345916cd2Sjpk int transfer_mode; 28445916cd2Sjpk bufp_t remote_dir; 28545916cd2Sjpk bufp_t filename; 28645916cd2Sjpk bufp_t local_dir; 28745916cd2Sjpk bufp_t display; 28845916cd2Sjpk char buf[BUFSIZE]; 28945916cd2Sjpk } zcopy_call_t; 29045916cd2Sjpk 29145916cd2Sjpk typedef struct { 29245916cd2Sjpk int status; 29345916cd2Sjpk } zcopy_ret_t; 29445916cd2Sjpk 29545916cd2Sjpk typedef struct { 29645916cd2Sjpk m_label_t label; 29745916cd2Sjpk uint_t flags; 29845916cd2Sjpk } pr_call_t; 29945916cd2Sjpk 30045916cd2Sjpk typedef struct { 30145916cd2Sjpk char buf[BUFSIZE]; 30245916cd2Sjpk } pr_ret_t; 30345916cd2Sjpk 30445916cd2Sjpk typedef struct { 30545916cd2Sjpk m_label_t label; 30645916cd2Sjpk uint_t flags; 30745916cd2Sjpk } ls_call_t; 30845916cd2Sjpk 30945916cd2Sjpk typedef struct { 31045916cd2Sjpk char buf[BUFSIZE]; 31145916cd2Sjpk } ls_ret_t; 31245916cd2Sjpk 31345916cd2Sjpk typedef struct { 31445916cd2Sjpk m_label_t label; 31545916cd2Sjpk uint_t flags; 31645916cd2Sjpk char string[BUFSIZE]; 31745916cd2Sjpk } sl_call_t; 31845916cd2Sjpk 31945916cd2Sjpk typedef struct { 32045916cd2Sjpk m_label_t label; 32145916cd2Sjpk } sl_ret_t; 32245916cd2Sjpk 32345916cd2Sjpk /* Labeld operation call structure */ 32445916cd2Sjpk 32545916cd2Sjpk typedef struct { 32645916cd2Sjpk uint_t op; 32745916cd2Sjpk union { 32845916cd2Sjpk null_call_t null_arg; 32945916cd2Sjpk 33045916cd2Sjpk inset_call_t inset_arg; 33145916cd2Sjpk slvalid_call_t slvalid_arg; 33245916cd2Sjpk clrvalid_call_t clrvalid_arg; 33345916cd2Sjpk info_call_t info_arg; 33445916cd2Sjpk vers_call_t vers_arg; 33545916cd2Sjpk color_call_t color_arg; 33645916cd2Sjpk 33745916cd2Sjpk bsltos_call_t bsltos_arg; 33845916cd2Sjpk bcleartos_call_t bcleartos_arg; 33945916cd2Sjpk 34045916cd2Sjpk stobsl_call_t stobsl_arg; 34145916cd2Sjpk stobclear_call_t stobclear_arg; 34245916cd2Sjpk 34345916cd2Sjpk bslcvt_call_t bslcvt_arg; 34445916cd2Sjpk bclearcvt_call_t bclearcvt_arg; 34545916cd2Sjpk fields_call_t fields_arg; 34645916cd2Sjpk udefs_call_t udefs_arg; 34745916cd2Sjpk setfbcl_call_t setfbcl_arg; 34845916cd2Sjpk zcopy_call_t zcopy_arg; 34945916cd2Sjpk pr_call_t pr_arg; 35045916cd2Sjpk ls_call_t ls_arg; 35145916cd2Sjpk sl_call_t sl_arg; 35245916cd2Sjpk } cargs; 35345916cd2Sjpk } labeld_call_t; 35445916cd2Sjpk 35545916cd2Sjpk /* Labeld operation return structure */ 35645916cd2Sjpk 35745916cd2Sjpk typedef struct { 35845916cd2Sjpk int ret; /* labeld return codes */ 35945916cd2Sjpk int err; /* function error codes */ 36045916cd2Sjpk union { 36145916cd2Sjpk null_ret_t null_ret; 36245916cd2Sjpk 36345916cd2Sjpk inset_ret_t inset_ret; 36445916cd2Sjpk slvalid_ret_t slvalid_ret; 36545916cd2Sjpk clrvalid_ret_t clrvalid_ret; 36645916cd2Sjpk info_ret_t info_ret; 36745916cd2Sjpk vers_ret_t vers_ret; 36845916cd2Sjpk color_ret_t color_ret; 36945916cd2Sjpk 37045916cd2Sjpk bsltos_ret_t bsltos_ret; 37145916cd2Sjpk bcleartos_ret_t bcleartos_ret; 37245916cd2Sjpk 37345916cd2Sjpk stobsl_ret_t stobsl_ret; 37445916cd2Sjpk stobclear_ret_t stobclear_ret; 37545916cd2Sjpk 37645916cd2Sjpk bslcvt_ret_t bslcvt_ret; 37745916cd2Sjpk bclearcvt_ret_t bclearcvt_ret; 37845916cd2Sjpk fields_ret_t fields_ret; 37945916cd2Sjpk udefs_ret_t udefs_ret; 38045916cd2Sjpk setfbcl_ret_t setfbcl_ret; 38145916cd2Sjpk zcopy_ret_t zcopy_ret; 38245916cd2Sjpk pr_ret_t pr_ret; 38345916cd2Sjpk ls_ret_t ls_ret; 38445916cd2Sjpk sl_ret_t sl_ret; 38545916cd2Sjpk } rvals; 38645916cd2Sjpk } labeld_ret_t; 38745916cd2Sjpk 38845916cd2Sjpk /* Labeld call/return structure */ 38945916cd2Sjpk 39045916cd2Sjpk typedef struct { 39145916cd2Sjpk union { 39245916cd2Sjpk labeld_call_t acall; 39345916cd2Sjpk labeld_ret_t aret; 39445916cd2Sjpk } param; 39545916cd2Sjpk } labeld_data_t; 39645916cd2Sjpk 39745916cd2Sjpk #define callop param.acall.op 39845916cd2Sjpk #define retret param.aret.ret 39945916cd2Sjpk #define reterr param.aret.err 40045916cd2Sjpk 40145916cd2Sjpk #define CALL_SIZE(type, buf) (size_t)(sizeof (type) + sizeof (int) + (buf)) 40245916cd2Sjpk #define RET_SIZE(type, buf) (size_t)(sizeof (type) + 2*sizeof (int) + (buf)) 403*e9d1e0cdSgww #define CALL_SIZE_STR(type, buf) CALL_SIZE(type, (-BUFSIZE +(buf))) 40445916cd2Sjpk 40545916cd2Sjpk /* Labeld common client call function */ 40645916cd2Sjpk 40745916cd2Sjpk int 40845916cd2Sjpk __call_labeld(labeld_data_t **dptr, size_t *ndata, size_t *adata); 40945916cd2Sjpk 41045916cd2Sjpk /* Return Codes */ 41145916cd2Sjpk 41245916cd2Sjpk #define SUCCESS 1 /* Call OK */ 41345916cd2Sjpk #define NOTFOUND -1 /* Function not found */ 41445916cd2Sjpk #define SERVERFAULT -2 /* Internal labeld error */ 41545916cd2Sjpk #define NOSERVER -3 /* No server thread available, try later */ 41645916cd2Sjpk 41745916cd2Sjpk /* Flag Translation Values */ 41845916cd2Sjpk 41945916cd2Sjpk #define L_NEW_LABEL 0x10000000 42045916cd2Sjpk 42145916cd2Sjpk /* GFI FLAGS */ 42245916cd2Sjpk 42345916cd2Sjpk #define GFI_FLAG_MASK 0x0000FFFF 42445916cd2Sjpk #define GFI_ACCESS_RELATED 0x00000001 42545916cd2Sjpk 42645916cd2Sjpk /* binary to ASCII */ 42745916cd2Sjpk 42845916cd2Sjpk #define LABELS_NO_CLASS 0x00010000 42945916cd2Sjpk #define LABELS_SHORT_CLASS 0x00020000 43045916cd2Sjpk #define LABELS_SHORT_WORDS 0x00040000 43145916cd2Sjpk 43245916cd2Sjpk /* Label view */ 43345916cd2Sjpk 43445916cd2Sjpk #define LABELS_VIEW_INTERNAL 0x00100000 43545916cd2Sjpk #define LABELS_VIEW_EXTERNAL 0x00200000 43645916cd2Sjpk 43745916cd2Sjpk /* Dimming list (convert -- b*cvt* ) */ 43845916cd2Sjpk 43945916cd2Sjpk #define LABELS_FULL_CONVERT 0x00010000 44045916cd2Sjpk 44145916cd2Sjpk /* ASCII to binary */ 44245916cd2Sjpk 44345916cd2Sjpk #define LABELS_NEW_LABEL 0x00010000 44445916cd2Sjpk #define LABELS_FULL_PARSE 0x00020000 44545916cd2Sjpk #define LABELS_ONLY_INFO_LABEL 0x00040000 44645916cd2Sjpk 44745916cd2Sjpk #define MOVE_FILE 0 44845916cd2Sjpk #define COPY_FILE 1 44945916cd2Sjpk #define LINK_FILE 2 45045916cd2Sjpk 45145916cd2Sjpk #define PIPEMSG_FILEOP_ERROR 1 45245916cd2Sjpk #define PIPEMSG_EXIST_ERROR 2 45345916cd2Sjpk #define PIPEMSG_DONE 7 45445916cd2Sjpk #define PIPEMSG_PATH_ERROR 20 45545916cd2Sjpk #define PIPEMSG_ZONE_ERROR 21 45645916cd2Sjpk #define PIPEMSG_LABEL_ERROR 22 45745916cd2Sjpk #define PIPEMSG_READ_ERROR 23 45845916cd2Sjpk #define PIPEMSG_READONLY_ERROR 24 45945916cd2Sjpk #define PIPEMSG_WRITE_ERROR 25 46045916cd2Sjpk #define PIPEMSG_CREATE_ERROR 26 46145916cd2Sjpk #define PIPEMSG_DELETE_ERROR 27 46245916cd2Sjpk #define PIPEMSG_CANCEL 101 46345916cd2Sjpk #define PIPEMSG_PROCEED 102 46445916cd2Sjpk #define PIPEMSG_MERGE 103 46545916cd2Sjpk #define PIPEMSG_REPLACE_BUFFER 104 46645916cd2Sjpk #define PIPEMSG_RENAME_BUFFER 105 46745916cd2Sjpk #define PIPEMSG_MULTI_PROCEED 106 46845916cd2Sjpk #define PIPEMSG_RENAME_FILE 107 46945916cd2Sjpk 47045916cd2Sjpk #ifdef __cplusplus 47145916cd2Sjpk } 47245916cd2Sjpk #endif 47345916cd2Sjpk 47445916cd2Sjpk #endif /* _LABELD_H */ 475