Skip site navigation (1)Skip section navigation (2)

  
 
  

home | help
DC_PLUG_READ(2) 		    distcache			 DC_PLUG_READ(2)

NAME
     DC_PLUG_read,     DC_PLUG_consume,    DC_PLUG_write,    DC_PLUG_write_more,
     DC_PLUG_commit, DC_PLUG_rollback - DC_PLUG read/write functions

SYNOPSIS
      #include <distcache/dc_plug.h>

      int DC_PLUG_read(DC_PLUG *plug, int resume, unsigned long *request_uid,
		       DC_CMD *cmd, const unsigned char **payload_data,
		       unsigned int *payload_len);
      int DC_PLUG_consume(DC_PLUG *plug);
      int DC_PLUG_write(DC_PLUG *plug, int resume, unsigned long request_uid,
			DC_CMD cmd, const unsigned char *payload_data,
			unsigned int payload_len);
      int DC_PLUG_write_more(DC_PLUG *plug, const unsigned char *data,
			     unsigned int data_len);
      int DC_PLUG_commit(DC_PLUG *plug);
      int DC_PLUG_rollback(DC_PLUG *plug);

      typedef enum {
	      DC_CMD_ERROR,
	      DC_CMD_ADD,
	      DC_CMD_GET,
	      DC_CMD_REMOVE,
	      DC_CMD_HAVE
      } DC_CMD;

DESCRIPTION
     DC_PLUG_read() will attempt to open the next distcache message received  by
     plug for reading. This message will block the reading of any other received
     messages remain until DC_PLUG_consume() is called. If a message has already
     been  opened  for reading inside plug, then DC_PLUG_read() will fail unless
     resume is set to non-zero in which case it will simply re-open the  message
     that  was already being read. If DC_PLUG_read() succeeds, request_uid, cmd,
     payload_data and payload_len are populated with the  message's  data.  Note
     that  payload_data  points to the original data stored inside plug and this
     pointer is only valid until the next call to DC_PLUG_consume().

     DC_PLUG_consume() will close the message currently opened	for  reading  in
     plug,  and  will  allow a future call to DC_PLUG_read() to succeed if there
     any subsequent (complete) messages received from the plug object's  connec-
     tion.

     DC_PLUG_write()  will  attempt  to  open a distcache message for writing in
     plug. If successful, this message will block the writing of any other  mes-
     sages  until  the	message  is committed with DC_PLUG_commit() or discarded
     with DC_PLUG_rollback(). If a message has already been opened for	writing,
     DC_PLUG_write()  will fail unless resume is non-zero in which case the mes-
     sage will be re-opened and will overwrite the settings  from  the	previous
     DC_PLUG_write() call. This is equivalent to DC_PLUG_rollback() followed im-
     mediately	by  DC_PLUG_write()  with  a  zero  resume value. Note that pay-
     load_len can be zero (and thus payload_data can be NULL) even if  the  mes-
     sage  will  eventually  have payload data - this can be supplemented after-
     wards using the DC_PLUG_write_more() function. request_uid and cmd, on  the
     other hand, must be specified at once in DC_PLUG_write().

     DC_PLUG_write_more()  will  attempt to add more payload data to the message
     currently opened for writing in plug. This data will be concatenated to the
     end of any payload data already provided in prior calls to  DC_PLUG_write()
     or DC_PLUG_write_more().

     DC_PLUG_commit()  will  close the message currently opened for writing, and
     queue it for serialisation out on the plug object's connection.

     DC_PLUG_rollback() will discard the message currently opened for writing.

RETURN VALUES
     All these DC_PLUG functions return zero on failure, otherwise non-zero.

SEE ALSO
     DC_PLUG_new(2) - Basic DC_PLUG functions.

     distcache(8) - Overview of the distcache architecture.

     http://www.distcache.org/ - Distcache home page.

AUTHOR
     This toolkit was designed and implemented by Geoff Thorpe for Cryptographic
     Appliances Incorporated. Since the project was released into  open  source,
     it  has  a  home  page and a project environment where development, mailing
     lists, and releases are organised. For problems with the software	or  this
     man  page please check for new releases at the project web-site below, mail
     the users mailing list described there, or contact the author at  geoff@ge-
     offthorpe.net.

     Home Page: http://www.distcache.org

1.5.1				   2004.10.19			 DC_PLUG_READ(2)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=DC_PLUG_read&sektion=2&manpath=FreeBSD+Ports+15.1.quarterly>

home | help