/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
# include <poll.h>
# include <stdarg.h>
# include <stropts.h>
#if !defined(_LP_MSGS_H)
# define _LP_MSGS_H
/*
* THE DISPATCH TABLE DEPENDS ON EACH R_... MESSAGE FOLLOWING
* IMMEDIATELY AFTER ITS CORRESPONDING S_... COUNTERPART.
* I.E R_... MESSAGE FOR A S_... MESSAGE IS (S_... + 1)
*/
# define R_BAD_MESSAGE 0
/* # define S_NEW_QUEUE 1 DEFUNCT */
/* # define R_NEW_QUEUE 2 DEFUNCT */
/* # define S_INQUIRE_REQUEST 13 DEFUNCT */
/* # define R_INQUIRE_REQUEST 14 DEFUNCT */
/* # define S_GETSTATUS 59 DEFUNCT */
/* # define R_GETSTATUS 60 DEFUNCT */
/*
** These are for use by the scheduler only
*/
/* # define R_CONNECT 71 DEFUNCT */
/* # define S_GET_STATUS 72 DEFUNCT */
/* # define R_GET_STATUS 73 DEFUNCT */
/* # define S_NEW_CHILD 78 DEFUNCT */
/* # define R_NEW_CHILD 79 DEFUNCT */
/* # define S_SEND_JOB 80 DEFUNCT */
/* # define R_SEND_JOB 81 DEFUNCT */
/* # define S_JOB_COMPLETED 82 DEFUNCT */
/* # define R_JOB_COMPLETED 83 DEFUNCT */
/* # define S_INQUIRE_REMOTE_PRINTER 84 DEFUNCT */
/* # define R_INQUIRE_REMOTE_PRINTER 20 DEFUNCT */
/* # define S_CHILD_SYNC 85 DEFUNCT */
/* # define S_LOAD_SYSTEM 86 DEFUNCT */
/* # define R_LOAD_SYSTEM 87 DEFUNCT */
/* # define S_UNLOAD_SYSTEM 88 DEFUNCT */
/* # define R_UNLOAD_SYSTEM 89 DEFUNCT */
/* new messages */
/*
** Last available message
*/
/*
** These are the possible status codes returned by the scheduler
*/
# define MOK 0
/*
** Offsets and lengths of the various elements of the message header.
**
** Macro Data Type Size Comment
**
** HEAD_RESYNC 2 bytes (2) *
** HEAD_AUTHCODE short + long (6) *
**
** HEAD_SIZE 4 bytes (4) \
** HEAD_TYPE 4 bytes (4) > message propper
** HEAD_DATA n bytes (n) /
**
** TAIL_CHKSUM 4 bytes (4) *
** TAIL_ENDSYNC 2 bytes (2) *
**
** Items marked with an asterisk are only used with the 3.2
** Spooler protocol.
*/
/*
** 3.2 Protocol Header Information:
** 2-byte message introduction
** 6-byte client authorization data
*/
#define HEAD_RESYNC (0)
#define HEAD_AUTHCODE_LEN (sizeof(short) + sizeof(long))
/*
** 3.2 Protocol Message Information:
** 4-byte message size
** 4-byte message type
** n-byte message data
*/
/*
** 3.2 Protocol Size of non-data header information
*/
/*
** Equivalents for 4.0 protocol
*/
#define MESG_SIZE (0)
/*
** 3.2 Protocol Trailer Information:
** 4-byte message check sum
** 2-byte message closing identifier
**
** "N" is the decoded value of buffer[HEAD_SIZE]. This must
** be provided because messages are variable length.
*/
/*
** 3.2 Protocol Size of non-data trailer information
*/
/*
** 3.2 Protocol Size of all non-data information
** (This is also the minimum size for 3.2 protocol messages)
*/
/*
** Size of excess data induced by 3.2 Protocol.
** (This is also the size differance between 3.2 & 4.0 protocols)
*/
/**
** Checksum:
**/
if (SZ >= CONTROL_LEN) \
{ \
register unsigned char *p = (unsigned char *)B, \
RC = 0; \
while (p < pend) \
RC += *p++; /* let it overflow */ \
} \
else \
/*
** Largest size permitted for any given message
*/
/*
** Possible values of the type field of S_QUIET_ALERT
*/
typedef struct mque
{
} MQUE;
/*
** Definition of a message descriptor
*/
typedef struct
{
} MESG;
/*
** Possible values of MESG.state
*/
# define MDS_IDLE 0
/*
** Possible values of MESG.type
*/
/*
** Definition for a FIFO buffer (used
** in read_fifo.
*/
typedef struct
{
int full;
*psave,
} fifobuffer_t;
/*
** Definitions for the rest of the world and lint
*/
/*
** Server functions in order of usage
*/
int mlisteninit ( MESG * );
int mlistenadd ( MESG *, short );
int mon_discon ( MESG *, void (*)());
MESG * mlistenreset ( void );
/*
** Client functions in order of typical usage
*/
short msize ( char * );
int mdisconnect ( MESG * );
/*
** This may be called to deallocate internal buffers allocated
** by mgetm and mputm. Probably not useful except right before
** a fork().
*/
void __mbfree ( void );
/*
** Client functions for pre-4.0 compatability
*/
int mclose ( void );
int mneeds ( void );
int mopen ( void );
int mrecv ( char *, int );
int msend ( char * );
int read_fifo (int, char *, unsigned int);
int write_fifo (int, char *, unsigned int);
int ResetFifoBuffer (int);
fifobuffer_t *GetFifoBuffer (int);
/*
** General purpose message manipulating functions
*/
char * htos ( char *, unsigned short );
char * ltos ( char *, unsigned long );
unsigned long stol ( char * );
unsigned short stoh ( char * );
int _getmessage ( char *, short, va_list );
int _putmessage ( char *, short, va_list );
int getmessage ( char *, short, ... );
int putmessage ( char *, short, ... );
/*
** This will yield the type of a message
*/
/*
** This will yeild the size of a message
*/
/*
** Pass this for the request-id argument of S_CANCEL
** to obtain the effect of the 3.2 S_CANCEL_REQUEST.
*/
#endif /* !defined (_LP_MSGS_H) */