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