home *** CD-ROM | disk | FTP | other *** search
- #ifndef QUARK_MESSAGE_H
- #define QUARK_MESSAGE_H
-
- typedef unsigned long long q_mid_t;
-
- /* the next line is fixed by SED when the file
- * is copied over to public
- */
- typedef void *q_message_t;
-
- #define QMSGPORTTAG_DUMMY (0x2000)
-
- /* Sequence: QMSGPORTTAG_NAME, char*
- * Function: Create
- * defines the public name of the port.
- */
- #define QMSGPORTTAG_NAME (QMSGPORTTAG_DUMMY + 0x1)
-
- /* Sequence: QMSGPORTTAG_TYPE, u_int32_t
- * Function: Create
- * defines the general access rights for the port.
- */
- #define QMSGPORTTAG_TYPE (QMSGPORTTAG_DUMMY + 0x2)
-
- /* Sequence: QMSGPORTTAG_ALLOWSEND, bool_t (Default is TRUE)
- * Function: Create
- * allows SendMessage() for the port
- */
-
- #define QMSGPORTTAG_ALLOWSEND (QMSGPORTTAG_DUMMY + 0x3)
-
- /* Sequence: QMSGPORTTAG_ALLOWREPLY, bool_t (Default is TRUE)
- * Function: Create
- * allows ReplyMessage() for the port
- */
-
- #define QMSGPORTTAG_ALLOWREPLY (QMSGPORTTAG_DUMMY + 0x4)
-
- /* Sequence: QMSGPORTTAG_MAXDATASIZE, u_int32_t
- * Function: Create
- * sets a limit for message databodies.
- * If the size is too big the msg is denied.
- */
-
- #define QMSGPORTTAG_MAXDATASIZE (QMSGPORTTAG_DUMMY + 0x5)
-
- /* Sequence: QMSGPORTTAG_SIGNAL, u_int32_t*
- * Function: Create
- * returns the port`s signal
- */
- #define QMSGPORTTAG_SIGNAL (QMSGPORTTAG_DUMMY + 0x6)
-
- /* Sequence: QMSGPORTTAG_TID, q_tid_t*
- * Function: Get
- * returns the port`s thread tid
- */
- #define QMSGPORTTAG_TID (QMSGPORTTAG_DUMMY + 0x7)
-
- /* Sequence: QMSGPORTTAG_ERROR, u_int32_t*
- * Function: returns the error code.
- * (not supported yet)
- */
- #define QMSGPORTTAG_ERROR (QMSGPORTTAG_DUMMY + 0x10)
-
-
- /*
- * QMSGPORTTAG_TYPE
- */
- #define QMSGPORTTYPE_LOCAL 0
- #define QMSGPORTTYPE_CLAN 1
- #define QMSGPORTTYPE_MACHINE 2
- #define QMSGPORTTYPE_NET 3
-
-
-
-
- #define QMESSAGETAG_DUMMY (0x3000)
-
- /* Sequence: QMESSAGETAG_LINK
- * Result: void *Message
- * Function: Set/Get
- * Link a msg with another message. The to be linked message
- * is added with a FIFO system to the root message.
- * On first look this looks weird but only on first look.
- * Example:
- * If an application does scsi io and this an io job
- * unit runs into an error the full error information
- * are only available until another job is done so the
- * the full error context must be handled in synchron.
- * Basicly 2 different io jobs must then be executed in
- * synchron...the io job and a request sense operation.
- * As the result space of a ReplyMsg doesn't always provide
- * enough space why not (pseudo-send) a direct followup msg
- * to the replied job msg. Normal sending a weird msg may
- * confuse the application but folding extended messages inside
- * of the return message is imho an elegant solution to this
- * problem.
- *
- */
- #define QMESSAGETAG_LINK (QMESSAGETAG_DUMMY+0x1)
-
- /* Sequence: QMESSAGETAG_TARGETPORT, MID*
- * Result: 0, real result is passed in the MID* ptr.
- * Function: Get only
- * Get the MID | TID of the target port
- */
- #define QMESSAGETAG_TARGETPORT (QMESSAGETAG_DUMMY+0x2)
-
- /* Sequence: QMESSAGETAG_REPLYPORT, MID*
- * Result: 0, real result is passed in the MID* ptr.
- * Function: Get only
- * Get the MID | TID of the replyport
- */
- #define QMESSAGETAG_REPLYPORT (QMESSAGETAG_DUMMY+0x3)
-
- /* Sequence: QMESSAGETAG_ARG1
- * Result: Arg1
- * Function: Set/Get
- * Get the arg1 argument
- */
- #define QMESSAGETAG_ARG1 (QMESSAGETAG_DUMMY+0x4)
-
- /* Sequence: QMESSAGETAG_ARG2
- * Result: Arg2
- * Get the arg2 argument
- */
- #define QMESSAGETAG_ARG2 (QMESSAGETAG_DUMMY+0x5)
-
- /* Sequence: QMESSAGETAG_ARG3
- * Result: Arg3
- * Function: Set/Get
- * Get the arg3 argument
- */
- #define QMESSAGETAG_ARG3 (QMESSAGETAG_DUMMY+0x6)
-
-
-
- /* Sequence: QMESSAGETAG_LENGTH
- * Result: Length
- * Function: Get only
- * Get the length argument.
- *
- */
- #define QMESSAGETAG_LENGTH (QMESSAGETAG_DUMMY+0x7)
-
- /* Sequence: QMESSAGETAG_DATA, void *Dest, u_int32_t Length
- * Result: Length, 0 for the Set operation indicates error.
- * Function: Set/Get
- * (Get)
- * Copies the data out of the message to the
- * destination buffer you specified with the
- * length you specified.
- *
- * (Set)
- * Copies the data into the buffer. Makes only
- * sense before a ReplyMessage.
- */
- #define QMESSAGETAG_DATA (QMESSAGETAG_DUMMY+0x8)
-
- /* Sequence: QMESSAGETAG_FREE
- * Result: Success
- * Function: Set only
- * Free unnecessary data resources. For example if you send a
- * huge message and the message`s internal buffer isn`t needed
- * anymore.
- */
- #define QMESSAGETAG_FREE (QMESSAGETAG_DUMMY+0x9)
-
- /* Sequence: QMESSAGETAG_ERROR
- * Result: Success
- * Function: Get only
- * Get an error id if some message operation failed.
- */
- #define QMESSAGETAG_ERROR (QMESSAGETAG_DUMMY+0xa)
-
- /* Sequence: QMESSAGETAG_ROUTED
- * Result: Success
- * Function: Get only
- * Get the state of a message if it was routed
- * and the receiver thread isn't the real target.
- */
- #define QMESSAGETAG_ROUTED (QMESSAGETAG_DUMMY+0xb)
-
- /* Sequence: QMESSAGETAG_INFO, struct QMessageInfo*
- * Result: Success
- * Function: Set/Get
- * Set/Get the info of a message.
- */
- #define QMESSAGETAG_INFO (QMESSAGETAG_DUMMY+0xc)
-
-
-
-
-
- struct QMessageInfo
- {
- q_mid_t ReplyPort;
- q_mid_t TargetPort;
- u_int32_t Flags;
- u_int32_t Arg1;
- u_int32_t Arg2;
- u_int32_t Arg3;
- u_int32_t Length;
- /*
- * If Data != NULL, then it`s a
- * simple DataPtr. This may be
- * a local taskspace ptr for inner
- * taskspace messages or a Ptr
- * for a mapped in shared memory.
- * The flags then specify the case
- * more clearly.
- */
- void *Data;
-
- /*
- * BufferPtr for a buffer copy
- * or NULL.
- */
- void *Buffer;
- /*
- * Max Length of the buffer
- */
- u_int32_t BufferLength;
- };
-
- typedef struct QMessageInfo *q_messageinfo_t;
-
-
- /*
- * DataPtr is pointing to the data
- * in the local taskspace
- */
- #define QMESSAGEINFOFLAGB_PTR 16
- #define QMESSAGEINFOFLAGF_PTR (1<<QMESSAGEINFOFLAGB_PTR)
-
- /*
- * DataPtr is pointing to gated
- * mmu pages.
- */
- #define QMESSAGEINFOFLAGB_MAPPED 17
- #define QMESSAGEINFOFLAGF_MAPPED (1<<QMESSAGEINFOFLAGB_MAPPED)
-
- /*
- * Buffercopy overflow
- */
- #define QMESSAGEINFOFLAGB_OVERFLOW 18
- #define QMESSAGEINFOFLAGF_OVERFLOW (1<<QMESSAGEINFOFLAGB_OVERFLOW)
-
-
-
- /*
- * Std Format for public message ports/tids
- * for Arg1..Arg3
- * Send:
- * Arg1
- * is always a methodid that specifies
- * the meaning of the message.
- *
- * Arg2
- * is depending on the methodid
- *
- * Arg3
- * is depending on the methodid
- *
- * Reply:
- * Arg1
- * is always the return status(ok,error)
- *
- * Arg2
- * is depending on the message result
- *
- * Arg3
- * is depending on the message result
- */
-
- /* System message ids start at this
- * point.
- */
- #define QMESSAGEMETHOD_SYSTEM 0x0
- #define QMESSAGEMETHOD_QUERY (QMESSAGEMETHOD_SYSTEM+0x1)
- #define QMESSAGEMETHOD_INIT (QMESSAGEMETHOD_SYSTEM+0x1)
-
- /***********************************************************************
- * Defines the (scope) list in which all following
- * linked jobs are operating.
- * Jobs are linked through the message link system
- * Arg1 == QMESSAGEMETHOD_EXCEPTION
- * Arg2 == ExceptionType...depends on the CPU
- * Arg3 == 0
- * Data == 0
- *
- * Reply:
- * None..msg sent with no replyport. So when your exception
- * handler replies it it gets deleted
- */
- #define QMESSAGEMETHOD_EXCEPTION (QMESSAGEMETHOD_SYSTEM+0x1000)
-
-
- /* User message ids start at this
- * point
- */
- #define QMESSAGEMETHOD_USER 0x80000000
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #define QMSGERROR_OK 0
- #define QMSGERROR_MEMORY 1
- #define QMSGERROR_UNKNOWNMID 2
- #define QMSGERROR_UNKNOWNTID 3
-
- /* Illegal MID id..not a MID and not a TID
- * Plain and simple..illegal
- */
- #define QMSGERROR_ILLEGALMID 4
-
- /* A message which wasn't sent can't be
- * replied
- */
- #define QMSGERROR_MSGCANTBEREPLIED 5
-
- /* The next msgport doesn't allow SendMessage
- */
-
- #define QMSGERROR_SENDDISABLED 6
-
- /* The next msgport doesn't allow ReplyMessage.
- */
- #define QMSGERROR_REPLYDISABLED 7
-
- /* Msg doesn`t belong to the current task space
- */
- #define QMSGERROR_MSGPIDERROR 8
-
- /* Msg can't be linked to itself
- */
- #define QMSGERROR_LINKNOTPOSSIBLE 9
-
- /* Msg body length is too large
- */
- #define QMSGERROR_TOOLARGE 10
-
-
-
-
- #define QMSGERROR_NOTIMPLEMENTED 100
-
- #endif
-
-