summaryrefslogtreecommitdiff
path: root/ACE/apps/JAWS/clients/Blobby
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/apps/JAWS/clients/Blobby')
-rw-r--r--ACE/apps/JAWS/clients/Blobby/Blob.cpp77
-rw-r--r--ACE/apps/JAWS/clients/Blobby/Blob.h87
-rw-r--r--ACE/apps/JAWS/clients/Blobby/Blob_Handler.cpp347
-rw-r--r--ACE/apps/JAWS/clients/Blobby/Blob_Handler.h118
-rw-r--r--ACE/apps/JAWS/clients/Blobby/Makefile.am40
-rw-r--r--ACE/apps/JAWS/clients/Blobby/Options.cpp81
-rw-r--r--ACE/apps/JAWS/clients/Blobby/Options.h71
-rw-r--r--ACE/apps/JAWS/clients/Blobby/README33
-rw-r--r--ACE/apps/JAWS/clients/Blobby/blobby.cpp125
-rw-r--r--ACE/apps/JAWS/clients/Blobby/blobby.mpc13
10 files changed, 0 insertions, 992 deletions
diff --git a/ACE/apps/JAWS/clients/Blobby/Blob.cpp b/ACE/apps/JAWS/clients/Blobby/Blob.cpp
deleted file mode 100644
index 3bd237c7a9c..00000000000
--- a/ACE/apps/JAWS/clients/Blobby/Blob.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-// $Id$
-
-#include "Blob.h"
-#include "Blob_Handler.h"
-#include "ace/OS_NS_string.h"
-
-ACE_RCSID(Blobby, Blob, "$Id$")
-
-ACE_Blob::ACE_Blob (void)
-{
-}
-
-ACE_Blob::~ACE_Blob (void)
-{
- this->close ();
-}
-
-// initialize address and filename. No network i/o in open
-
-int
-ACE_Blob::open (const ACE_TCHAR *filename, const ACE_TCHAR *hostname , u_short port)
-{
- filename_ = ACE_OS::strdup (filename);
- inet_addr_.set (port, hostname);
- return 0;
-}
-
-// read from connection length bytes from offset, into Message block
-
-int
-ACE_Blob::read (ACE_Message_Block *mb, size_t length, size_t offset)
-{
-
- // Create a Blob Reader
- ACE_Blob_Reader blob_reader (mb, length, offset, filename_);
- ACE_Blob_Handler *brp = &blob_reader;
-
- // Connect to the server
- if (connector_.connect (brp, inet_addr_) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob::read():Connector error"), -1);
-
- return blob_reader.byte_count ();
-
-}
-
-// write to connection length bytes from offset, into Message block
-
-int
-ACE_Blob::write (ACE_Message_Block *mb, size_t length, size_t offset)
-{
-
- // Create a Blob Writer
- ACE_Blob_Writer blob_writer (mb, length, offset, filename_);
- ACE_Blob_Handler *bwp = &blob_writer;
-
- // Connect to the server
- if (connector_.connect (bwp, inet_addr_) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob::write():Connector error"), -1);
-
- return blob_writer.byte_count ();
-}
-
-// close down the blob
-
-int
-ACE_Blob::close (void)
-{
-
- if (filename_)
- {
- ACE_OS::free ((void *) filename_);
- filename_ = 0;
- }
- return 0;
-
-}
-
diff --git a/ACE/apps/JAWS/clients/Blobby/Blob.h b/ACE/apps/JAWS/clients/Blobby/Blob.h
deleted file mode 100644
index 9ba35fb0176..00000000000
--- a/ACE/apps/JAWS/clients/Blobby/Blob.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-//============================================================================
-//
-// = LIBRARY
-// JAWS
-//
-// = FILENAME
-// Blob.h
-//
-// = DESCRIPTION
-// This is the ACE_Blob class, which is the API for doing file
-// uploads/downloads.
-//
-// = AUTHOR
-// Prashant Jain and Sumedh Mungee
-//
-//============================================================================
-
-#ifndef ACE_BLOB_H
-#define ACE_BLOB_H
-
-#include "ace/config-all.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/INET_Addr.h"
-#include "ace/Svc_Handler.h"
-#include "ace/SOCK_Connector.h"
-#include "ace/Connector.h"
-#include "ace/Message_Block.h"
-#include "Blob_Handler.h"
-
-class ACE_Blob
- // = TITLE
- // Blob is intended to provide application API to
- // classes that wish to do network i/o at a very
- // high level of abstraction.
- //
- // = This class provides the ability to retrieve data from
- // the network, of specified length and offset, and potentially
- // use any protocol "under the hood" to do so. It currently
- // uses HTTP. See Blob_Handler also.
-{
-public:
- ACE_Blob (void);
- ~ACE_Blob (void);
-
- int open (const ACE_TCHAR *filename,
- const ACE_TCHAR *hostname = ACE_DEFAULT_SERVER_HOST,
- u_short port = 80);
- // initializes the class with the given filename, hostname and port.
- // it should be called with the filename, before any read/write calls
-
-
- int read (ACE_Message_Block *mb, size_t length, size_t offset);
- // starts a connection, and reads a file from the server,
- // of length and offset as specified, into Message_Block mb
- // The message block should have capacity to hold length number
- // of bytes
-
- int write (ACE_Message_Block *mb, size_t length, size_t offset);
- // starts a connection, and writes a file to the server,
- // of length and offset as specified, from Message_Block mb
- // thus the message block should contain atleast length + offset
- // bytes of data
-
-
- int close ();
- // Frees memory allocated for filename.
-
-private:
- ACE_INET_Addr inet_addr_;
- // store the internet address of the server
-
- ACE_TCHAR *filename_;
- // The filename
-
- ACE_Connector<ACE_Blob_Handler, ACE_SOCK_CONNECTOR> connector_;
- // The connector endpoint to initiate the client connection
-
-};
-
-#endif /* ACE_BLOB_H */
diff --git a/ACE/apps/JAWS/clients/Blobby/Blob_Handler.cpp b/ACE/apps/JAWS/clients/Blobby/Blob_Handler.cpp
deleted file mode 100644
index 8ae5cde6e9b..00000000000
--- a/ACE/apps/JAWS/clients/Blobby/Blob_Handler.cpp
+++ /dev/null
@@ -1,347 +0,0 @@
-// $Id$
-
-#include "Blob_Handler.h"
-#include "ace/OS_NS_stdio.h"
-#include "ace/OS_NS_string.h"
-#include "ace/OS_NS_strings.h"
-
-ACE_RCSID(Blobby, Blob_Handler, "$Id$")
-
-// Empty constructor for compliance with new Connector behavior.
-ACE_Blob_Handler::ACE_Blob_Handler (void)
-{
-}
-
-// Always use this constructor
-ACE_Blob_Handler::ACE_Blob_Handler (ACE_Message_Block * mb,
- size_t length,
- size_t offset,
- ACE_TCHAR *filename) :
- mb_ (mb),
- length_ (length),
- offset_ (offset),
- filename_ (ACE_OS::strdup (filename)),
- bytecount_ (0)
-{
-}
-
-ACE_Blob_Handler::~ACE_Blob_Handler (void)
-{
- if (filename_)
- {
- ACE_OS::free ((void *) filename_);
- filename_ = 0;
- }
-}
-
-// Called by Connector after connection is established
-int
-ACE_Blob_Handler::open (void *)
-{
- if (this->send_request () != 0)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Handler::open():send_request failed"), -1);
-
- if (this->receive_reply () != 0)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Handler::open():receive_reply failed"), -1);
- return 0;
-
-}
-
-// No-op
-int
-ACE_Blob_Handler::close (u_long flags)
-{
- ACE_UNUSED_ARG (flags);
- return 0;
-}
-
-
-// Always overridden by the derived classes
-int
-ACE_Blob_Handler::send_request (void)
-{
- return -1;
-}
-
-// Always overridden by the derived classes
-int
-ACE_Blob_Handler::receive_reply (void)
-{
- return -1;
-}
-
-// used to retrieve the number of bytes read/written by the
-// last operation on the Blob
-int
-ACE_Blob_Handler::byte_count (void)
-{
- return bytecount_;
-}
-
-// Reader **************************************************
-
-ACE_Blob_Reader::ACE_Blob_Reader (ACE_Message_Block * mb,
- size_t length,
- size_t offset,
- ACE_TCHAR *filename,
- const char *request_prefix,
- const char *request_suffix) :
- ACE_Blob_Handler (mb, length, offset, filename),
- request_prefix_ (request_prefix),
- request_suffix_ (request_suffix)
-{
-}
-
-// Send the HTTP request
-int
-ACE_Blob_Reader::send_request (void)
-{
- char mesg [MAX_HEADER_SIZE];
-
- // Check to see if the request is too big
- if (MAX_HEADER_SIZE < (ACE_OS::strlen (request_prefix_)
- + ACE_OS::strlen (filename_)
- + ACE_OS::strlen (request_suffix_) + 4))
- ACE_ERROR_RETURN((LM_ERROR,"Request too large!"), -1);
-
- // Create a message to send to the server requesting retrieval of the file
- int len = ACE_OS::sprintf (mesg, "%s %s %s", request_prefix_, filename_, request_suffix_);
-
- // Send the message to server
- if (peer ().send_n (mesg, len) != len)
- ACE_ERROR_RETURN((LM_ERROR,"Error sending request"), -1);
-
-
- return 0;
-}
-
-// Recieve the HTTP Reply
-int
-ACE_Blob_Reader::receive_reply (void)
-{
- ssize_t len;
- char buf [MAX_HEADER_SIZE + 1];
- char *buf_ptr;
- size_t bytes_read = 0;
- size_t bytes_left = this->length_;
- size_t offset_left = this->offset_;
-
- // Receive the first MAX_HEADER_SIZE bytes to be able to strip off the
- // header. Note that we assume that the header will fit into the
- // first MAX_HEADER_SIZE bytes of the transmitted data.
- if ((len = peer ().recv_n (buf, MAX_HEADER_SIZE)) >= 0)
- {
- buf[len] = '\0';
-
- // Search for the header termination string "\r\n\r\n", or "\n\n". If
- // found, move past it to get to the data portion.
- if ((buf_ptr = ACE_OS::strstr (buf,"\r\n\r\n")) != 0)
- buf_ptr += 4;
- else if ((buf_ptr = ACE_OS::strstr (buf, "\n\n")) != 0)
- buf_ptr += 2;
- else
- buf_ptr = buf;
-
- // Determine number of data bytes read. This is equal to the
- // total bytes read minus number of header bytes.
- bytes_read = (buf + len) - buf_ptr;
- }
- else
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Reader::receiveReply():Error while reading header"), -1);
-
- // ***************************************************************
- // At this point, we have stripped off the header and are ready to
- // process data. buf_ptr points to the data
-
- // First adjust for offset. There are two cases:
- // (1) The first block of data encountered the offset. In this case
- // we simply increment the buf_ptr by offset.
- // (2) The first block of data did not encounter the offset. That
- // is, the offset needs to go past the number of data bytes already read.
- if (bytes_read > offset_left)
- {
- // The first case is true -- that is offset is less than the
- // data bytes we just read.
- buf_ptr += offset_left;
-
- // Determine how many data bytes are actually there. This is
- // basically the total number of data bytes we read minus any
- // offset we have.
- size_t data_bytes = bytes_read - offset_left;
-
- // Check for the case where the bytes read are enough to fulfill
- // our request (for length bytes). If this is the case, then we
- // don't need to do any extra recvs and can simply return with
- // the data.
- if (data_bytes >= bytes_left)
- {
- // The first block contains enough data to satisfy the
- // length. So copy the data into the message buffer.
- if (mb_->copy (buf_ptr, bytes_left) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n",
- "ACE Blob_Reader::receiveReply():Error copying data into Message_Block"), -1);
- bytecount_ = length_;
- return 0;
- }
-
- // Copy over all the data bytes into our message buffer.
- if (mb_->copy (buf_ptr, data_bytes) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n",
- "ACE_Blob_Reader::receiveReply():Error copying data into Message_Block" ), -1);
-
- // Adjust bytes left
- bytes_left -= data_bytes;
-
- // No more offset left. So set it to zero.
- offset_left = 0;
- }
- else
- {
- // The second case is true -- that is offset is greater than
- // the data bytes we just read.
- offset_left -= bytes_read;
- }
-
- // If we ad any offset left, take care of that.
- while (offset_left > 0)
- {
- // MAX_HEADER_SIZE in which case we should do a receive of
- // offset bytes into a temporary buffer. Otherwise, we should
- // receive MAX_HEADER_SIZE bytes into temporary buffer and
- // decrement offset_left.
- if (offset_left < (sizeof buf))
- len = offset_left;
- else
- len = sizeof buf;
- if (peer().recv_n (buf, len) != len)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n",
- "ACE_Blob_Reader::receiveReply():Read error" ),
- -1);
- offset_left -= len;
- }
-
- // *****************************************************************
- // At this point we are all set to receive the actual data which the
- // user wants. We have made adjustments for offset and are ready to
- // receive the actual data. Receive the data directly into the
- // message buffer.
-
- len = peer().recv_n (mb_->wr_ptr (), bytes_left);
-
- if (len < 0 || static_cast<size_t> (len) != bytes_left)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n",
- "ACE_Blob_Reader::receiveReply():Read error" ),
- -1);
-
- // Adjust the message buffer write pointer by number of bytes we
- // received.
- mb_->wr_ptr (len);
-
- // Set the byte count to number of bytes received
- this->bytecount_ = length_;
-
- return 0;
-}
-
-// Writer **************************************************
-
-ACE_Blob_Writer::ACE_Blob_Writer (ACE_Message_Block * mb,
- size_t length,
- size_t offset,
- ACE_TCHAR *filename,
- const char *request_prefix,
- const char *request_suffix) :
- ACE_Blob_Handler (mb, length, offset, filename),
- request_prefix_ (request_prefix),
- request_suffix_ (request_suffix)
-{
-}
-
-int
-ACE_Blob_Writer::send_request (void)
-{
- // Check for sanity -- check if we have any data to send.
- if (offset_+ length_ > mb_->length ())
- ACE_ERROR_RETURN((LM_ERROR, "%p\n",
- "ACE_Blob_Writer::sendRequest():Invalid offset/length"), -1);
-
- // Determine the length of the header message we will be sending to
- // the server. Note that we add 32 for safety -- this corresponds to
- // the number of bytes needed for the length field.
- size_t mesglen =
- ACE_OS::strlen (request_prefix_)
- + ACE_OS::strlen (filename_)
- + ACE_OS::strlen (request_suffix_)
- + 32; // safety
-
- // Allocate a buffer to hold the header
- char *mesg = 0;
- ACE_NEW_RETURN (mesg, char [mesglen], -1);
-
- // Create the header, store the actual length in mesglen.
- // NOTE! %lu is really what's wanted. ACE_SIZE_T_FORMAT_SPECIFIER is
- // defined in terms of ACE_TEXT which is NOT what we want here.
- mesglen = ACE_OS::sprintf (mesg, "%s /%s %s %lu\n\n",
- request_prefix_, filename_, request_suffix_,
- (unsigned long)length_);
-
- // Send the header followed by the data
-
- // First send the header
- if (peer ().send_n (mesg, mesglen) == -1)
- ACE_ERROR_RETURN((LM_ERROR, "%p\n", "Error sending request"), -1);
-
- // "Consume" the offset by moving the read pointer of the message
- // buffer
- mb_->rd_ptr (offset_);
-
- // Now send the data
- if (peer ().send_n (mb_->rd_ptr (), length_) != (int)length_)
- ACE_ERROR_RETURN((LM_ERROR, "%p\n", "Error sending file"), -1);
-
- // Adjust the read pointer of the mesage buffer
- mb_->rd_ptr (length_);
-
- return 0;
-}
-
-int
-ACE_Blob_Writer::receive_reply (void)
-{
- // Allocate a buffer big enough to hold the header
- char buf[MAX_HEADER_SIZE];
-
- // Receive the reply from the server
- size_t num_recvd = 0;
- ssize_t len = peer ().recv_n (buf, sizeof buf - 1, 0, &num_recvd); // reserve one byte to store the \0
- if (len ==-1)
- ACE_ERROR_RETURN((LM_ERROR, "%p\n", "Error reading header"), -1);
-
- buf [num_recvd] = 0;
-
- // Parse the header
- char *lasts = 0;
-
- // First check if this was a valid header -- HTTP/1.0
- char *token = ACE_OS::strtok_r (buf, " \t", &lasts);
-
- if ( (token == 0) || (ACE_OS::strcasecmp (token, "HTTP/1.0") != 0))
- ACE_ERROR_RETURN((LM_ERROR, "%p\n", "Did not receive a HTTP/1.0 response"), -1);
-
- // Get the return code.
- int return_code = ACE_OS::atoi (ACE_OS::strtok_r (0, " \t", &lasts));
-
- // Check if the transaction succeeded. The only success codes are in
- // the range of 200-299 (HTTP specification).
- if (return_code >= 200 && return_code < 300)
- return 0;
- else
- {
- // Something went wrong!
- // Get the description from the header message of what went wrong.
- char *description = ACE_OS::strtok_r (0, "\n\r", &lasts);
- ACE_ERROR_RETURN((LM_ERROR, "%p\n", description), -1);
- }
- ACE_NOTREACHED(return 0);
-}
-
diff --git a/ACE/apps/JAWS/clients/Blobby/Blob_Handler.h b/ACE/apps/JAWS/clients/Blobby/Blob_Handler.h
deleted file mode 100644
index 41e13ff9c03..00000000000
--- a/ACE/apps/JAWS/clients/Blobby/Blob_Handler.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-//============================================================================
-//
-// = LIBRARY
-// JAWS
-//
-// = FILENAME
-// Blob.h
-//
-// = DESCRIPTION
-// ACE_Blob_Handler is a base class for ACE_Blob_Reader and
-// ACE_Blob_Writer which are created in response to calls to
-// read/write, as appropriate
-//
-// = AUTHOR
-// Prashant Jain and Sumedh Mungee
-//
-//============================================================================
-
-#ifndef ACE_BLOB_HANDLER_H
-#define ACE_BLOB_HANDLER_H
-
-#include "ace/config-all.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/SOCK_Stream.h"
-#include "ace/Svc_Handler.h"
-#include "ace/Message_Block.h"
-
-class ACE_Blob_Handler : public ACE_Svc_Handler <ACE_SOCK_STREAM, ACE_NULL_SYNCH>
- // = TITLE
- // Blob is intended to provide application API to
- // classes that wish to do network i/o at a very
- // high level of abstraction.
- //
- // = This class provides the ability to retrieve data from
- // the network, of specified length and offset, and potentially
- // use any protocol "under the hood" to do so. It currently
- // uses HTTP. See Blob_Handler also.
-{
-public:
- ACE_Blob_Handler (void);
- // Null constructor, insures that it works properly with Connector
-
- ACE_Blob_Handler (ACE_Message_Block *mb,
- size_t length,
- size_t offset,
- ACE_TCHAR *filename);
- // Always use this constructor to make Blob_Handlers
-
- int byte_count (void);
- // returns the number of bytes read/written in the last operation.
-
- virtual int open (void * = 0);
- // Activate this instance of the <ACE_Blob_Handler>
-
- virtual int close (u_long flags = 0);
- // Close down the Blob
-
- ~ACE_Blob_Handler (void);
-
-protected:
- virtual int send_request (void);
- virtual int receive_reply (void);
-
- ACE_Message_Block *mb_;
- size_t length_;
- size_t offset_;
- ACE_TCHAR *filename_;
- int bytecount_;
- enum
- {
- MAX_HEADER_SIZE = 2048
- // The handler assumes that the first 2048 bytes of a server response
- // contains the header
- };
-};
-
-class ACE_Blob_Reader : public ACE_Blob_Handler
-{
-public:
- ACE_Blob_Reader (ACE_Message_Block *mb,
- size_t length,
- size_t offset,
- ACE_TCHAR *filename,
- const char *request_prefix = "GET",
- const char *request_suffix = "HTTP/1.0\r\n\r\n");
-
-private:
- int send_request (void);
- int receive_reply (void);
- const char *request_prefix_;
- const char *request_suffix_;
-};
-
-class ACE_Blob_Writer : public ACE_Blob_Handler
-{
-public:
- ACE_Blob_Writer (ACE_Message_Block *mb,
- size_t length,
- size_t offset,
- ACE_TCHAR *filename,
- const char *request_prefix = "PUT",
- const char *request_suffix = "HTTP/1.0\nContent-length:");
-
-private:
- int send_request (void);
- int receive_reply (void);
- const char *request_prefix_;
- const char *request_suffix_;
-};
-
-#endif /* ACE_BLOB_HANDLER_H */
diff --git a/ACE/apps/JAWS/clients/Blobby/Makefile.am b/ACE/apps/JAWS/clients/Blobby/Makefile.am
deleted file mode 100644
index 1e0071f74d1..00000000000
--- a/ACE/apps/JAWS/clients/Blobby/Makefile.am
+++ /dev/null
@@ -1,40 +0,0 @@
-## Process this file with automake to create Makefile.in
-##
-## $Id$
-##
-## This file was generated by MPC. Any changes made directly to
-## this file will be lost the next time it is generated.
-##
-## MPC Command:
-## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
-
-ACE_BUILDDIR = $(top_builddir)
-ACE_ROOT = $(top_srcdir)
-
-## Makefile.blobby.am
-
-noinst_PROGRAMS = blobby
-
-blobby_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR)
-
-blobby_SOURCES = \
- Blob.cpp \
- Blob_Handler.cpp \
- Options.cpp \
- blobby.cpp \
- Blob.h \
- Blob_Handler.h \
- Options.h
-
-blobby_LDADD = \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-## Clean up template repositories, etc.
-clean-local:
- -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
- -rm -f gcctemp.c gcctemp so_locations *.ics
- -rm -rf cxx_repository ptrepository ti_files
- -rm -rf templateregistry ir.out
- -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/ACE/apps/JAWS/clients/Blobby/Options.cpp b/ACE/apps/JAWS/clients/Blobby/Options.cpp
deleted file mode 100644
index 08f7de4ad8b..00000000000
--- a/ACE/apps/JAWS/clients/Blobby/Options.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-// $Id$
-
-#include "ace/Get_Opt.h"
-#include "ace/ARGV.h"
-#include "Blob.h"
-#include "Blob_Handler.h"
-#include "Options.h"
-
-ACE_RCSID(Blobby, Options, "$Id$")
-
-Options *Options::instance_ = 0;
-
-Options *
-Options::instance (void)
-{
-
- if (Options::instance_ == 0)
- Options::instance_ = new Options;
-
- return Options::instance_;
-}
-
-void
-Options::parse_args (int argc, ACE_TCHAR *argv[])
-{
- ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("rwh:p:f:l:o:d"));
-
- int c;
-
- while ((c = get_opt ()) != -1)
- switch (c)
- {
- case 'd':
- this->debug_ = 1;
- break;
- case 'r':
- this->operation_ = 'r';
- break;
- case 'w':
- this->operation_ = 'w';
- break;
- case 'h':
- this->hostname_ = get_opt.opt_arg ();
- break;
- case 'p':
- this->port_ = ACE_OS::atoi (get_opt.opt_arg ());
- break;
- case 'f':
- this->filename_ = get_opt.opt_arg ();
- break;
- case 'l':
- this->length_ = ACE_OS::atoi (get_opt.opt_arg ());
- break;
- case 'o':
- this->offset_ = ACE_OS::atoi (get_opt.opt_arg ());
- break;
- // Usage fallthrough.
- default:
- ACE_DEBUG ((LM_DEBUG, "%s -h hostname -f filename -[r/w] [-p port] [-l length] [-o offset] [-d]\n", argv[0]));
- ACE_OS::exit (1);
- }
- if (this->hostname_ == 0 || this->filename_ == 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- "%s -h hostname -f filename -[r/w] [-p port] [-l length] [-o offset] [-d]\n",
- argv[0]));
- ACE_OS::exit (1);
- }
-
-}
-
-Options::Options (void)
- : hostname_ (0),
- port_ (ACE_DEFAULT_HTTP_SERVER_PORT),
- filename_ (0),
- length_ (0),
- offset_ (0),
- operation_ ('r'),
- debug_ (0)
-{
-}
diff --git a/ACE/apps/JAWS/clients/Blobby/Options.h b/ACE/apps/JAWS/clients/Blobby/Options.h
deleted file mode 100644
index 8396cf5535b..00000000000
--- a/ACE/apps/JAWS/clients/Blobby/Options.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-//============================================================================
-//
-// = LIBRARY
-// JAWS
-//
-// = FILENAME
-// Options.h
-//
-// = DESCRIPTION
-// Options is an Singleton for blobby
-//
-// = AUTHOR
-// Prashant Jain and Sumedh Mungee
-//
-//============================================================================
-
-#ifndef ACE_BLOBBY_OPTIONS_H
-#define ACE_BLOBBY_OPTIONS_H
-
-#include "Blob.h"
-#include "Blob_Handler.h"
-#include "ace/Get_Opt.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/ARGV.h"
-
-class Options
-{
-public:
- static Options *instance (void);
- // Returns the singleton instance
-
- void parse_args (int argc, ACE_TCHAR *argv[]);
- // parses commandline arguments
-
- ACE_TCHAR *hostname_;
- // Hostname to connect to
-
- u_short port_;
- // Port number to use
-
- ACE_TCHAR *filename_;
- // Filename to upload/download
-
- int length_;
- // number of bytes to read/write
-
- int offset_;
- // offset to read/write
-
- char operation_;
- // "r" means download (read), and "w" means upload (write).
-
- int debug_;
- // turns on verbosity
-
-protected:
- Options (void);
- // protected constructor, singleton
-
- static Options *instance_;
- // the singleton
-};
-
-#endif /* ACE_BLOBBY_OPTIONS_H */
diff --git a/ACE/apps/JAWS/clients/Blobby/README b/ACE/apps/JAWS/clients/Blobby/README
deleted file mode 100644
index 1a1cadf91ca..00000000000
--- a/ACE/apps/JAWS/clients/Blobby/README
+++ /dev/null
@@ -1,33 +0,0 @@
-README for blobby, the example application for JAWS
----------------------------------------------------
-
-Blobby is a simple application written using the ACE_Blob class, which
-is capable of doing both file uploads and downloads from the JAWS
-server.
-
-If a file is downloaded, the downloaded data is sent to standard
-output, so that it can be piped as necessary.
-
-It is an ACE application, and should be compiled exactly like any
-other ACE application.
-
-It accepts the following command line arguments:
-
-
- -r Read (download) the file from the server
- -w Write (upload) the file to the server
- (Default is Read file)
-
- -h hostname Use the server running on hostname
- (Default is localhost)
-
- -p port Port number of the server
- (Default is 80)
-
- -f filename The file to upload/download from the server
-
- -l length The number of bytes to read/write from the server
- -o offset The offset into the file to be read/written
-
- -d Puts blobby into debug mode, where it echoes
- its command line arguments
diff --git a/ACE/apps/JAWS/clients/Blobby/blobby.cpp b/ACE/apps/JAWS/clients/Blobby/blobby.cpp
deleted file mode 100644
index e614b049c20..00000000000
--- a/ACE/apps/JAWS/clients/Blobby/blobby.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-// $Id$
-
-//============================================================================
-//
-// = LIBRARY
-// JAWS
-//
-// = FILENAME
-// blobby.c
-//
-// = DESCRIPTION
-// Simple client application to illustrate the use of the ACE_Blob class
-//
-// It reads "length" number of bytes, after skipping offset "offset"
-// from hostname, port and filename as specified. (if -r specified)
-//
-// It writes "length" number of bytes, after skipping offset "offset"
-// to hostname, port and filename as specified (if -w specified)
-//
-// = AUTHOR
-// Prashant Jain and Sumedh Mungee
-//
-//============================================================================
-
-#include "Options.h"
-#include "ace/OS_main.h"
-#include "ace/OS_NS_fcntl.h"
-#include "ace/OS_NS_unistd.h"
-
-ACE_RCSID(Blobby, blobby, "$Id$")
-
-int
-ACE_TMAIN (int argc, ACE_TCHAR *argv[])
-{
- // Options is a singleton
- Options *options = Options::instance ();
- options->parse_args (argc, argv);
-
- // Explain what is going to happen
- if (options->debug_)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("hostname = %C, port = %d, filename = %s, ")
- ACE_TEXT ("length = %d, offset = %d, operation = %c\n"),
- options->hostname_,
- options->port_,
- options->filename_,
- options->length_,
- options->offset_,
- options->operation_));
-
- // Create a blob
- ACE_Blob blob;
-
- // User requested a read
- if (options->operation_ == 'r')
- {
- ACE_Message_Block mb (0, options->length_);
-
- // Open the blob
- if (blob.open (options->filename_,
- options->hostname_,
- options->port_) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("%p\n"),
- ACE_TEXT ("open error")),
- -1);
-
- // Read from it
- if (blob.read (&mb, options->length_, options->offset_) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("%p\n"),
- ACE_TEXT ("read error")),
- -1);
-
- // Write to STDOUT
- if (ACE_OS::write (ACE_STDOUT, mb.rd_ptr(), mb.length()) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("%p\n"),
- ACE_TEXT ("write error")),
- -1);
- }
- else
- {
- int total = options->length_ + options->offset_;
- ACE_Message_Block mb (total);
-
- // Open the file to be sent
- ACE_HANDLE h = ACE_OS::open (options->filename_, O_RDONLY);
- if (h == ACE_INVALID_HANDLE)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("%p\n"),
- ACE_TEXT ("file open error")),
- -1);
-
- // Open the blob
- if (blob.open (options->filename_, options->hostname_, options->port_) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("%p\n"),
- ACE_TEXT ("connection open error")),
- -1);
-
- // Read from the file
- if (ACE_OS::read (h, mb.wr_ptr (), total) != total)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("%p\n"),
- ACE_TEXT ("file read error")),
- -1);
-
- // Close the file
- ACE_OS::close (h);
-
- // Adjust the offset
- mb.wr_ptr (mb.size ());
-
- // Write to the blob
- if (blob.write (&mb, options->length_, options->offset_) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("%p\n"),
- ACE_TEXT ("network write error")),
- -1);
- }
-
- blob.close ();
- return 0;
-}
diff --git a/ACE/apps/JAWS/clients/Blobby/blobby.mpc b/ACE/apps/JAWS/clients/Blobby/blobby.mpc
deleted file mode 100644
index 40bcf1bbe65..00000000000
--- a/ACE/apps/JAWS/clients/Blobby/blobby.mpc
+++ /dev/null
@@ -1,13 +0,0 @@
-// -*- MPC -*-
-// $Id$
-
-project(blobby) : aceexe {
- exename = blobby
- Source_Files {
- blobby.cpp
- Blob.cpp
- Blob_Handler.cpp
- Options.cpp
- }
-}
-