Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Apropos / Subsearch:
optional field

msgb(4)								      msgb(4)


  msgb - Defines a STREAMS message block


  #include <&lt;sys/stream.h>&gt;
  struct msgb {
	  struct msgb *b_next;
	  struct msgb *b_prev;
	  struct msgb *b_cont;
	  unsigned char	*b_rptr;
	  unsigned char	*b_wptr;
	  struct datab *b_datap;


  b_next    A pointer to the next message on the queue.

  b_prev    A pointer to the previous message on the queue.

  b_cont    A pointer to the next message block	in the message.

  b_rptr    A pointer to the first unread data byte in the buffer.

  b_wptr    A pointer to the first unwritten data byte in the buffer.

  b_datap   A pointer to the datab structure (data block) that contains	the
	    data for the message.

	    Additional fields that are visible within the kernel.  The fields
	    included and their contents	depend on the kernel configuration.


  The msgb structure defines a message block.  A message block carries data
  or information in a stream.  A STREAMS message consists of message blocks
  linked through b_cont.  Each message block points to a data block descrip-
  tor, which in	turn points to a data buffer.

  The msgb structure is	typedefed as mblk_t.  The associated data block	is
  stored in a datab structure, which is	typedefed as dblk_t.

  The datab structure is defined (in sys/stream.h) as:

       struct datab {
	       struct datab *  db_freep;
	       unsigned	char * db_base;
	       unsigned	char * db_lim;
	       unsigned	char   db_ref;
	       unsigned	char   db_type;
	       unsigned	char   db_class;
	       unsigned	char   db_pad[1];

  The datab fields are defined as follows:

  db_freep  Used internally by the STREAMS memory allocator.

  db_base   The	first byte of the buffer.

  db_lim    The	last byte of the buffer, plus one.

  db_ref    The	number of message blocks ( struct msgb)	that reference this
	    data block.

  db_type   The	message	type.

  db_class  Used internally.

  db_pade   Padding.

  Messages are typed according to the value in the db_type  field in the
  associated datab  structure.	Some possible type values are:

  M_DATA    The	message	contains ordinary data.

  M_PROTO   The	message	contains internal control information and data.

  As part of its support for STREAMS, Tru64 UNIX provides the following
  interfaces for exchanging messages betweens STREAMS modules on the one hand
  and sockets and network protocols on the other:

    +  mbuf_to_mblk() -	Converts an mbuf chain to an mblk chain

    +  mblk_to_mbuf() -	Converts an mblk chain to an mbuf chain