2 * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved.
4 * This software may be freely used, copied, modified, and distributed
5 * provided that the above copyright notice is preserved in all copies of the
15 * msgbuild.h - utilities for assembling and interpreting ADP messages
18 #ifndef angel_msgbuild_h
19 #define angel_msgbuild_h
26 * We use a "varargs" function to enable a description of how the
27 * final message should look to be provided. We use a function rather
28 * than in-line macros to keep the size of Angel small.
30 * The "buffer" pointer is the starting point from where the data will
31 * be written. Note: If a NULL pointer is passed then no data will be
32 * written, but the size information will be returned. This allows
33 * code to call this routine with a NULL "buffer" pointer to ascertain
34 * whether the pointer they are passing contains enough space for the
35 * message being constructed.
37 * The "format" string should contain sequences of the following
39 * %w - insert 32bit word value
40 * %p - insert 32bit target pointer value
41 * %h - insert 16bit value
42 * %b - insert 8bit byte value
44 * The return parameter is the final byte length of the data written.
46 unsigned int msgbuild(unsigned char *buffer
, const char *format
, ...);
47 unsigned int vmsgbuild(unsigned char *buffer
, const char *format
,
50 /*---------------------------------------------------------------------------*/
55 * As for msgbuild except that it allocates a buffer, formats the data as
56 * for msgbuild and transmits the packet. Returns 0 if successful non 0 if ot
58 * Not for use on cooked channels e.g. debug channels only.
60 extern int msgsend(ChannelID chan
, const char *format
, ...);
62 /*---------------------------------------------------------------------------*/
67 * This basically does the opposite of msg_build, it takes a message, and
68 * a scanf type format string (but much cut down functionality) and returns
69 * the arguments in the message.
71 extern unsigned int unpack_message(unsigned char *buffer
, const char *format
, ...);
73 #endif /* ndef angel_msgbuild_h */
This page took 0.0297500000000001 seconds and 4 git commands to generate.