1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SLP_INTERNAL_H 28*0Sstevel@tonic-gate #define _SLP_INTERNAL_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #ifdef __cplusplus 33*0Sstevel@tonic-gate extern "C" { 34*0Sstevel@tonic-gate #endif 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate #include <thread.h> 37*0Sstevel@tonic-gate #include <synch.h> 38*0Sstevel@tonic-gate #include <errno.h> 39*0Sstevel@tonic-gate #include <string.h> 40*0Sstevel@tonic-gate #include <stdlib.h> 41*0Sstevel@tonic-gate #include <limits.h> 42*0Sstevel@tonic-gate #include <sys/types.h> 43*0Sstevel@tonic-gate #include <sys/uio.h> 44*0Sstevel@tonic-gate #include <slp.h> 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate /* SLPv2 function numbers */ 47*0Sstevel@tonic-gate #define SRVRQST 1 48*0Sstevel@tonic-gate #define SRVRPLY 2 49*0Sstevel@tonic-gate #define SRVREG 3 50*0Sstevel@tonic-gate #define SRVDEREG 4 51*0Sstevel@tonic-gate #define SRVACK 5 52*0Sstevel@tonic-gate #define ATTRRQST 6 53*0Sstevel@tonic-gate #define ATTRRPLY 7 54*0Sstevel@tonic-gate #define DAADVERT 8 55*0Sstevel@tonic-gate #define SRVTYPERQST 9 56*0Sstevel@tonic-gate #define SRVTYPERPLY 10 57*0Sstevel@tonic-gate #define SAADVERT 11 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gate /* SLPv2 protocol error functions, hidden under the API */ 60*0Sstevel@tonic-gate typedef enum { 61*0Sstevel@tonic-gate SLP_MSG_PARSE_ERROR = 256, /* used internally */ 62*0Sstevel@tonic-gate SLP_VER_NOT_SUPPORTED = 9, 63*0Sstevel@tonic-gate SLP_SICK_DA = 10, 64*0Sstevel@tonic-gate SLP_DA_BUSY_NOW = 11, 65*0Sstevel@tonic-gate SLP_OPTION_NOT_UNDERSTOOD = 12, 66*0Sstevel@tonic-gate SLP_RQST_NOT_SUPPORTED = 13 67*0Sstevel@tonic-gate } slp_proto_err; 68*0Sstevel@tonic-gate 69*0Sstevel@tonic-gate /* Defaults and properties */ 70*0Sstevel@tonic-gate #define SLP_VERSION 2 71*0Sstevel@tonic-gate #define SLP_DEFAULT_SENDMTU 1400 72*0Sstevel@tonic-gate #define SLP_PORT 427 73*0Sstevel@tonic-gate #define SLP_DEFAULT_MAXWAIT 15000 74*0Sstevel@tonic-gate #define SLP_DEFAULT_MAXRESULTS -1 75*0Sstevel@tonic-gate #define SLP_MULTICAST_ADDRESS inet_addr("239.255.255.253") 76*0Sstevel@tonic-gate #define SLP_MAX_STRINGLEN USHRT_MAX 77*0Sstevel@tonic-gate #define SLP_MAX_MSGLEN 16777216 /* max message length 2^24 */ 78*0Sstevel@tonic-gate #define SLP_SUN_SCOPES_TAG "424242SUN-TABLE-SCOPES424242" 79*0Sstevel@tonic-gate #define SLP_SUN_VERSION_TAG "424242SUN-TABLE-VERSION424242" 80*0Sstevel@tonic-gate 81*0Sstevel@tonic-gate /* Property names */ 82*0Sstevel@tonic-gate #define SLP_CONFIG_USESCOPES "net.slp.useScopes" 83*0Sstevel@tonic-gate #define SLP_CONFIG_ISBROADCASTONLY "net.slp.isBroadcastOnly" 84*0Sstevel@tonic-gate #define SLP_CONFIG_MULTICASTTTL "net.slp.multicastTTL" 85*0Sstevel@tonic-gate #define SLP_CONFIG_MULTICASTMAXWAIT "net.slp.multicastMaximumWait" 86*0Sstevel@tonic-gate #define SLP_CONFIG_DATAGRAMTIMEOUTS "net.slp.datagramTimeouts" 87*0Sstevel@tonic-gate #define SLP_CONFIG_MULTICASTTIMEOUTS "net.slp.multicastTimeouts" 88*0Sstevel@tonic-gate #define SLP_CONFIG_MTU "net.slp.mtu" 89*0Sstevel@tonic-gate #define SLP_CONFIG_INTERFACES "net.slp.interfaces" 90*0Sstevel@tonic-gate #define SLP_CONFIG_LOCALE "net.slp.locale" 91*0Sstevel@tonic-gate #define SLP_CONFIG_MAXRESULTS "net.slp.maxResults" 92*0Sstevel@tonic-gate #define SLP_CONFIG_USEGETXXXBYYYY "sun.net.slp.usegetxxxbyyyy" 93*0Sstevel@tonic-gate #define SLP_CONFIG_TYPEHINT "net.slp.typeHint" 94*0Sstevel@tonic-gate #define SLP_CONFIG_SECURITY_ON "net.slp.securityEnabled" 95*0Sstevel@tonic-gate #define SLP_CONFIG_SPI "sun.net.slp.SPIs" 96*0Sstevel@tonic-gate #define SLP_CONFIG_SIGN_AS "sun.net.slp.signAs" 97*0Sstevel@tonic-gate #define SLP_CONFIG_BYPASS_AUTH "sun.net.slp.bypassAuth" 98*0Sstevel@tonic-gate #define SLP_CONFIG_AUTH_BACKEND "sun.net.slp.authBackend" 99*0Sstevel@tonic-gate #define SLP_SUN_DA_TYPE "service:directory-agent.sun" 100*0Sstevel@tonic-gate 101*0Sstevel@tonic-gate #define SLP_DEFAULT_CONFIG_FILE "/etc/inet/slp.conf" 102*0Sstevel@tonic-gate 103*0Sstevel@tonic-gate extern void slp_readConfig(void); 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate /* Synchronized queue structures and functions */ 106*0Sstevel@tonic-gate 107*0Sstevel@tonic-gate typedef void slp_queue_t; 108*0Sstevel@tonic-gate 109*0Sstevel@tonic-gate extern slp_queue_t *slp_new_queue(SLPError *); 110*0Sstevel@tonic-gate extern SLPError slp_enqueue(slp_queue_t *, void *); 111*0Sstevel@tonic-gate extern SLPError slp_enqueue_at_head(slp_queue_t *, void *); 112*0Sstevel@tonic-gate extern void *slp_dequeue_timed(slp_queue_t *, timestruc_t *, SLPBoolean *); 113*0Sstevel@tonic-gate extern void *slp_dequeue(slp_queue_t *); 114*0Sstevel@tonic-gate extern void slp_flush_queue(slp_queue_t *, void (*)(void *)); 115*0Sstevel@tonic-gate extern void slp_destroy_queue(slp_queue_t *); 116*0Sstevel@tonic-gate 117*0Sstevel@tonic-gate typedef struct { 118*0Sstevel@tonic-gate struct iovec *iov; 119*0Sstevel@tonic-gate int iovlen; 120*0Sstevel@tonic-gate char *msg; 121*0Sstevel@tonic-gate struct iovec prlistlen; 122*0Sstevel@tonic-gate struct iovec *prlist; 123*0Sstevel@tonic-gate struct iovec scopeslen; 124*0Sstevel@tonic-gate struct iovec *scopes; 125*0Sstevel@tonic-gate } slp_msg_t; 126*0Sstevel@tonic-gate 127*0Sstevel@tonic-gate /* Implementation of SLPHandle */ 128*0Sstevel@tonic-gate typedef struct handle_impl { 129*0Sstevel@tonic-gate const char *locale; /* language tag */ 130*0Sstevel@tonic-gate int fid; /* SLP function ID */ 131*0Sstevel@tonic-gate slp_msg_t msg; /* The SLP message */ 132*0Sstevel@tonic-gate mutex_t *tcp_lock; /* TCP thread wait lock */ 133*0Sstevel@tonic-gate int tcp_ref_cnt; /* TCP thread reference count */ 134*0Sstevel@tonic-gate cond_t *tcp_wait; /* TCP thread wait condition var */ 135*0Sstevel@tonic-gate SLPBoolean async; /* asynchronous flag */ 136*0Sstevel@tonic-gate slp_queue_t *q; /* message queue for this handle */ 137*0Sstevel@tonic-gate thread_t producer_tid; /* thr ID of message producer */ 138*0Sstevel@tonic-gate thread_t consumer_tid; /* thr ID of message consumer */ 139*0Sstevel@tonic-gate int cancel; /* cancellation flag */ 140*0Sstevel@tonic-gate void *ifinfo; /* interface info */ 141*0Sstevel@tonic-gate SLPBoolean force_multicast; /* for SAAdvert solicitations */ 142*0Sstevel@tonic-gate SLPBoolean internal_call; /* current call is an internal op */ 143*0Sstevel@tonic-gate SLPBoolean pending_outcall; /* is handle in use? */ 144*0Sstevel@tonic-gate mutex_t outcall_lock; /* protects pending_outcall */ 145*0Sstevel@tonic-gate cond_t outcall_cv; /* outcall cond var */ 146*0Sstevel@tonic-gate SLPBoolean close_on_end; /* cleanup on slp_end_call */ 147*0Sstevel@tonic-gate } slp_handle_impl_t; 148*0Sstevel@tonic-gate 149*0Sstevel@tonic-gate extern SLPError slp_start_call(slp_handle_impl_t *); 150*0Sstevel@tonic-gate extern void slp_end_call(slp_handle_impl_t *); 151*0Sstevel@tonic-gate extern void slp_cleanup_handle(slp_handle_impl_t *); 152*0Sstevel@tonic-gate 153*0Sstevel@tonic-gate /* UA common functionality */ 154*0Sstevel@tonic-gate typedef void SLPGenericAppCB(); 155*0Sstevel@tonic-gate typedef SLPBoolean SLPMsgReplyCB(slp_handle_impl_t *, char *, void (*)(), 156*0Sstevel@tonic-gate void *, void **, int *); 157*0Sstevel@tonic-gate 158*0Sstevel@tonic-gate extern SLPError slp_ua_common(SLPHandle, const char *, SLPGenericAppCB, void *, 159*0Sstevel@tonic-gate SLPMsgReplyCB); 160*0Sstevel@tonic-gate 161*0Sstevel@tonic-gate extern SLPError slp_packSrvRqst(const char *, const char *, 162*0Sstevel@tonic-gate slp_handle_impl_t *); 163*0Sstevel@tonic-gate extern SLPError slp_packSrvRqst_single(const char *, const char *, 164*0Sstevel@tonic-gate const char *, char **, 165*0Sstevel@tonic-gate const char *); 166*0Sstevel@tonic-gate extern SLPBoolean slp_unpackSrvReply(slp_handle_impl_t *, char *, 167*0Sstevel@tonic-gate SLPSrvURLCallback, void *, 168*0Sstevel@tonic-gate void **, int *); 169*0Sstevel@tonic-gate extern SLPError slp_packAttrRqst_single(const char *, 170*0Sstevel@tonic-gate const char *, 171*0Sstevel@tonic-gate const char *, 172*0Sstevel@tonic-gate char **, 173*0Sstevel@tonic-gate const char *); 174*0Sstevel@tonic-gate extern SLPBoolean slp_UnpackAttrReply(slp_handle_impl_t *, char *, 175*0Sstevel@tonic-gate SLPAttrCallback, void *, 176*0Sstevel@tonic-gate void **, int *); 177*0Sstevel@tonic-gate extern SLPError slp_getDAbyScope(const char *, slp_queue_t *); 178*0Sstevel@tonic-gate extern SLPError slp_SAAdvert(slp_handle_impl_t *, void *); 179*0Sstevel@tonic-gate extern SLPError slp_unpackDAAdvert(char *, char **, char **, char **, 180*0Sstevel@tonic-gate char **, SLPError *); 181*0Sstevel@tonic-gate extern SLPError slp_unpackSAAdvert(char *, char **, char **, char **); 182*0Sstevel@tonic-gate 183*0Sstevel@tonic-gate /* target selection routines */ 184*0Sstevel@tonic-gate typedef void slp_target_list_t; 185*0Sstevel@tonic-gate typedef void slp_target_t; 186*0Sstevel@tonic-gate extern SLPError slp_new_target_list(slp_handle_impl_t *hp, const char *, 187*0Sstevel@tonic-gate slp_target_list_t **); 188*0Sstevel@tonic-gate extern const char *slp_get_uc_scopes(slp_target_list_t *); 189*0Sstevel@tonic-gate extern const char *slp_get_mc_scopes(slp_target_list_t *); 190*0Sstevel@tonic-gate extern slp_target_t *slp_next_uc_target(slp_target_list_t *); 191*0Sstevel@tonic-gate extern slp_target_t *slp_next_failover(slp_target_t *); 192*0Sstevel@tonic-gate extern void *slp_get_target_sin(slp_target_t *); 193*0Sstevel@tonic-gate extern void slp_mark_target_used(slp_target_t *); 194*0Sstevel@tonic-gate extern void slp_mark_target_failed(slp_target_t *); 195*0Sstevel@tonic-gate extern slp_target_t *slp_fabricate_target(void *); 196*0Sstevel@tonic-gate extern void slp_free_target(slp_target_t *); 197*0Sstevel@tonic-gate extern void slp_destroy_target_list(slp_target_list_t *); 198*0Sstevel@tonic-gate 199*0Sstevel@tonic-gate /* short-lived DA cache */ 200*0Sstevel@tonic-gate extern char *slp_find_das_cached(const char *); 201*0Sstevel@tonic-gate extern void slp_put_das_cached(const char *, const char *, unsigned int); 202*0Sstevel@tonic-gate 203*0Sstevel@tonic-gate /* networking */ 204*0Sstevel@tonic-gate extern void slp_uc_tcp_send(slp_handle_impl_t *, slp_target_t *, 205*0Sstevel@tonic-gate const char *, SLPBoolean, unsigned short); 206*0Sstevel@tonic-gate extern void slp_uc_udp_send(slp_handle_impl_t *, slp_target_t *, 207*0Sstevel@tonic-gate const char *); 208*0Sstevel@tonic-gate extern void slp_mc_send(slp_handle_impl_t *, const char *); 209*0Sstevel@tonic-gate extern void slp_tcp_wait(slp_handle_impl_t *); 210*0Sstevel@tonic-gate extern SLPError slp_tcp_read(int, char **); 211*0Sstevel@tonic-gate extern char *slp_ntop(char *, int, const void *); 212*0Sstevel@tonic-gate extern int slp_pton(const char *, void *); 213*0Sstevel@tonic-gate 214*0Sstevel@tonic-gate /* IPC */ 215*0Sstevel@tonic-gate extern SLPError slp_send2slpd(const char *, char **); 216*0Sstevel@tonic-gate extern SLPError slp_send2slpd_iov(struct iovec *, int, char **); 217*0Sstevel@tonic-gate 218*0Sstevel@tonic-gate /* SLP-style list management */ 219*0Sstevel@tonic-gate extern int slp_onlist(const char *, const char *); 220*0Sstevel@tonic-gate extern void slp_add2list(const char *, char **, SLPBoolean); 221*0Sstevel@tonic-gate extern void slp_list_subtract(const char *, char **); 222*0Sstevel@tonic-gate 223*0Sstevel@tonic-gate /* searching and storing */ 224*0Sstevel@tonic-gate typedef enum { preorder, postorder, endorder, leaf } VISIT; 225*0Sstevel@tonic-gate extern void slp_twalk(void *, void (*)(void *, VISIT, int, void *), 226*0Sstevel@tonic-gate int, void *); 227*0Sstevel@tonic-gate extern void *slp_tsearch(const void *, void **, int (*)()); 228*0Sstevel@tonic-gate extern void *slp_tfind(const void *, void *const *, 229*0Sstevel@tonic-gate int (*)(const void *, const void *)); 230*0Sstevel@tonic-gate 231*0Sstevel@tonic-gate /* DA and scope discovery routines */ 232*0Sstevel@tonic-gate extern SLPError slp_find_das(const char *, char **); 233*0Sstevel@tonic-gate extern SLPError slp_administrative_scopes(char **, SLPBoolean); 234*0Sstevel@tonic-gate 235*0Sstevel@tonic-gate /* UTF8 routines */ 236*0Sstevel@tonic-gate extern char *slp_utf_strchr(const char *, char); 237*0Sstevel@tonic-gate extern int slp_strcasecmp(const char *, const char *); 238*0Sstevel@tonic-gate 239*0Sstevel@tonic-gate /* Error reporting */ 240*0Sstevel@tonic-gate extern void slp_err(int, int, char *, char *, ...); 241*0Sstevel@tonic-gate 242*0Sstevel@tonic-gate /* Mapping from protocol to API error codes */ 243*0Sstevel@tonic-gate extern SLPError slp_map_err(unsigned short); 244*0Sstevel@tonic-gate 245*0Sstevel@tonic-gate /* Security: signing and verifying */ 246*0Sstevel@tonic-gate extern SLPError slp_sign(struct iovec *, int, time_t, struct iovec *, int); 247*0Sstevel@tonic-gate extern SLPError slp_verify(struct iovec *, int, const char *, 248*0Sstevel@tonic-gate size_t, int, size_t *); 249*0Sstevel@tonic-gate 250*0Sstevel@tonic-gate /* Config convenience wrappers */ 251*0Sstevel@tonic-gate extern size_t slp_get_mtu(); 252*0Sstevel@tonic-gate extern int slp_get_next_onlist(char **); 253*0Sstevel@tonic-gate extern int slp_get_maxResults(); 254*0Sstevel@tonic-gate #define slp_get_mcmaxwait() atoi(SLPGetProperty(SLP_CONFIG_MULTICASTMAXWAIT)) 255*0Sstevel@tonic-gate #define slp_get_maxresults() atoi(SLPGetProperty(SLP_CONFIG_MAXRESULTS)) 256*0Sstevel@tonic-gate #define slp_get_multicastTTL() atoi(SLPGetProperty(SLP_CONFIG_MULTICASTTTL)) 257*0Sstevel@tonic-gate #define slp_get_usebroadcast() \ 258*0Sstevel@tonic-gate (!strcasecmp(SLPGetProperty(SLP_CONFIG_ISBROADCASTONLY), "true")) 259*0Sstevel@tonic-gate #define slp_get_security_on() \ 260*0Sstevel@tonic-gate (!strcasecmp(SLPGetProperty(SLP_CONFIG_SECURITY_ON), "true")) 261*0Sstevel@tonic-gate #define slp_get_bypass_auth() \ 262*0Sstevel@tonic-gate (!strcasecmp(SLPGetProperty(SLP_CONFIG_BYPASS_AUTH), "true")) 263*0Sstevel@tonic-gate 264*0Sstevel@tonic-gate /* Primitive encoding routines */ 265*0Sstevel@tonic-gate extern SLPError slp_add_byte(char *, size_t, int, size_t *); 266*0Sstevel@tonic-gate extern SLPError slp_add_sht(char *, size_t, unsigned short, size_t *); 267*0Sstevel@tonic-gate extern SLPError slp_add_int32(char *, size_t, unsigned int, size_t *); 268*0Sstevel@tonic-gate extern SLPError slp_add_string(char *, size_t, const char *, size_t *); 269*0Sstevel@tonic-gate extern SLPError slp_get_byte(const char *, size_t, size_t *, int *); 270*0Sstevel@tonic-gate extern SLPError slp_get_sht(const char *, size_t, size_t *, unsigned short *); 271*0Sstevel@tonic-gate extern SLPError slp_get_int32(const char *, size_t, size_t *, unsigned int *); 272*0Sstevel@tonic-gate extern SLPError slp_get_string(const char *, size_t, size_t *, char **); 273*0Sstevel@tonic-gate 274*0Sstevel@tonic-gate /* Header generation and handling */ 275*0Sstevel@tonic-gate 276*0Sstevel@tonic-gate /* OFFSETS to fields in the header */ 277*0Sstevel@tonic-gate #define SLP_VER 0 278*0Sstevel@tonic-gate #define SLP_FUN 1 279*0Sstevel@tonic-gate #define SLP_LEN 2 280*0Sstevel@tonic-gate #define SLP_FLAGS 5 281*0Sstevel@tonic-gate #define SLP_NEXTOP 7 282*0Sstevel@tonic-gate #define SLP_XID 10 283*0Sstevel@tonic-gate #define SLP_LANGLEN 12 284*0Sstevel@tonic-gate #define SLP_HDRLEN 14 285*0Sstevel@tonic-gate 286*0Sstevel@tonic-gate /* Flags */ 287*0Sstevel@tonic-gate #define SLP_OVERFLOW (char)0x80 288*0Sstevel@tonic-gate #define SLP_FRESH (char)0x40 289*0Sstevel@tonic-gate #define SLP_MCAST (char)0x20 290*0Sstevel@tonic-gate 291*0Sstevel@tonic-gate /* One byte macros (not needing byte order conversion) */ 292*0Sstevel@tonic-gate #define slp_get_version(h) (h)[SLP_VER] 293*0Sstevel@tonic-gate #define slp_set_version(h, v) (h)[SLP_VER] = (v); 294*0Sstevel@tonic-gate #define slp_get_function(h) (h)[SLP_FUN] 295*0Sstevel@tonic-gate #define slp_set_function(h, f) (h)[SLP_FUN] = (f) 296*0Sstevel@tonic-gate #define slp_get_overflow(h) ((h)[SLP_FLAGS] & SLP_OVERFLOW) 297*0Sstevel@tonic-gate #define slp_set_overflow(h) (h)[SLP_FLAGS] |= SLP_OVERFLOW 298*0Sstevel@tonic-gate #define slp_set_fresh(h) (h)[SLP_FLAGS] |= SLP_FRESH 299*0Sstevel@tonic-gate #define slp_set_mcast(h) (h)[SLP_FLAGS] |= SLP_MCAST 300*0Sstevel@tonic-gate 301*0Sstevel@tonic-gate /* Routines requiring byte order conversions */ 302*0Sstevel@tonic-gate extern unsigned short slp_header_get_sht(const char *, size_t); 303*0Sstevel@tonic-gate extern void slp_header_set_sht(char *, unsigned short, size_t); 304*0Sstevel@tonic-gate extern unsigned int slp_header_get_int24(const char *, size_t); 305*0Sstevel@tonic-gate extern void slp_header_set_int24(char *, unsigned int, size_t); 306*0Sstevel@tonic-gate extern slp_proto_err slp_get_errcode(char *); 307*0Sstevel@tonic-gate #define slp_get_length(h) slp_header_get_int24((h), SLP_LEN) 308*0Sstevel@tonic-gate #define slp_set_length(h, x) slp_header_set_int24((h), (int)(x), SLP_LEN) 309*0Sstevel@tonic-gate #define slp_get_langlen(h) slp_header_get_sht((h), SLP_LANGLEN) 310*0Sstevel@tonic-gate #define slp_set_langlen(h, x) slp_header_set_sht((h), (x), SLP_LANGLEN) 311*0Sstevel@tonic-gate #define slp_get_option(h) slp_header_get_int24((h), SLP_NEXTOP) 312*0Sstevel@tonic-gate #define slp_set_option(h, x) slp_header_set_int24((h), (x), SLP_NEXTOP) 313*0Sstevel@tonic-gate #define slp_get_xid(h) slp_header_get_sht((h), SLP_XID) 314*0Sstevel@tonic-gate #define slp_set_xid(h, x) slp_header_set_sht((h), (x), SLP_XID) 315*0Sstevel@tonic-gate 316*0Sstevel@tonic-gate extern SLPError slp_add_header(const char *, char *, size_t, int, 317*0Sstevel@tonic-gate size_t, size_t *); 318*0Sstevel@tonic-gate #define slp_hdrlang_length(h) \ 319*0Sstevel@tonic-gate (SLP_HDRLEN + strlen(((slp_handle_impl_t *)(h))->locale)) 320*0Sstevel@tonic-gate 321*0Sstevel@tonic-gate #ifdef __cplusplus 322*0Sstevel@tonic-gate } 323*0Sstevel@tonic-gate #endif 324*0Sstevel@tonic-gate 325*0Sstevel@tonic-gate #endif /* _SLP_INTERNAL_H */ 326