/*
- * $Source$
- * $Header$
+ * $Source$
+ * $Header$
*/
#ifndef lint
static char *rcsid_gdb_ops_c = "$Header$";
-#endif lint
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/************************************************************************/
-/*
-/* gdb_ops.c
-/*
-/* GDB - Asynchronous Operations and Their Synchronous
-/* Counterparts
-/*
-/* Author: Noah Mendelsohn
-/* Copyright: 1986 MIT Project Athena
-/* For copying and distribution information, please see
-/* the file <mit-copyright.h>.
-/*
-/* These routines provide a suite of asynchronous operations
-/* on connections.
-/*
-/************************************************************************/
+#endif
+
+
+/************************************************************************
+ *
+ * gdb_ops.c
+ *
+ * GDB - Asynchronous Operations and Their Synchronous
+ * Counterparts
+ *
+ * Author: Noah Mendelsohn
+ * Copyright: 1986 MIT Project Athena
+ * For copying and distribution information, please see
+ * the file <mit-copyright.h>.
+ *
+ * These routines provide a suite of asynchronous operations
+ * on connections.
+ *
+ ************************************************************************/
#include <mit-copyright.h>
#include <stdio.h>
#include "gdb.h"
#include <netinet/in.h>
#include <sys/ioctl.h>
-#ifdef vax
-extern u_long htonl();
-#endif vax
-\f
-/************************************************************************/
-/*
-/* send_object (send_object)
-/*
-/* Synchronous form of start_sending_object. Returns either
-/* OP_CANCELLED, or OP_RESULT(op).
-/*
-/************************************************************************/
+#ifdef SOLARIS
+#include <sys/filio.h>
+#endif
+
+/************************************************************************
+ *
+ * send_object (send_object)
+ *
+ * Synchronous form of start_sending_object. Returns either
+ * OP_CANCELLED, or OP_RESULT(op).
+ *
+ ************************************************************************/
int
send_object(con, objp, type)
delete_operation(op);
return retval;
}
-\f
+
+
/************************************************************************/
/*
/* start_send_object (g_snobj)
/* marked as the 'continuation' routine, which will cause its
/* invocation when the transmission completes.
/*
-/* The data is preceded by its length expressed as a long in
+/* The data is preceded by its length expressed as a 32-bit number in
/* network byte order.
/*
/************************************************************************/
/* called by the connection management logic when the send
/* request percolates to the top of the queue. This routine
/* reformats the data into an appropriate form for transmission.
- /* The format used is a length, represented as a long in
+ /* The format used is a length, represented as a 32-bit # in
/* network byte order, followed by the data itself. The
/* continuation routine below is called, either synchronously
/* or asynchronously, once the transmission is complete.
/*
* Allocate space and flatten (encode) the data
*/
- arg->flattened = db_alloc(arg->len+sizeof(long));
- *(u_long *)arg->flattened = htonl((u_long)arg->len);
+ arg->flattened = db_alloc(arg->len+sizeof(int32));
+ *(uint32 *)arg->flattened = htonl((uint32)arg->len);
FCN_PROPERTY(arg->type, ENCODE_PROPERTY)
- (arg->objp, hcon, arg->flattened+sizeof(long));
+ (arg->objp, hcon, arg->flattened+sizeof(int32));
/*
* Set up continuation routine in case it's needed after the return
/*
* Start sending the data, maybe even complete
*/
- if (gdb_send_data(hcon, arg->flattened, arg->len + sizeof(long)) ==
+ if (gdb_send_data(hcon, arg->flattened, arg->len + sizeof(int32)) ==
OP_COMPLETE) {
return g_csnobj(op, hcon, arg) ;/* this return is a little */
/* subtle. As continuation */
/*
/*----------------------------------------------------------*/
+/*ARGSUSED*/
int
g_csnobj(op, hcon, arg)
OPERATION op;
struct obj_data *arg;
{
op->result = OP_SUCCESS;
- db_free((char *)arg->flattened, arg->len + sizeof(long));
+ db_free((char *)arg->flattened, arg->len + sizeof(int32));
/* free the sent data */
db_free((char *)arg, sizeof(struct obj_data)); /* free the state structure */
return OP_COMPLETE;
}
-\f
+
/************************************************************************/
/*
/* receive_object (receive_object)
delete_operation(op);
return retval;
}
-\f
+
+
/************************************************************************/
/*
/* start_receiving_object (g_rcobj)
/* to read the object itself. When the object itself has been read, it
/* is decoded and the operation completes.
/*
-/* The data is preceded by its length expressed as a long in
+/* The data is preceded by its length expressed as a 32-bit number in
/* network byte order.
/*
/* preempt_and_start_receiving_object (g_prcobj)
/* Initialization routine for receiving an object.
/* Called when the receive operation percolates to the
/* top of the queue. First, we must receive the single
- /* 'long' which carries the length of the rest of the data.
+ /* 32-bit # which carries the length of the rest of the data.
/* We do that now, either synchronously or asynchronously.
/*
/*----------------------------------------------------------*/
struct robj_data *arg;
{
op->fcn.cont = g_c1rcobj;
- if(gdb_receive_data(hcon, (char *)&(arg->len), sizeof(long)) == OP_COMPLETE) {
+ if(gdb_receive_data(hcon, (char *)&(arg->len), sizeof(int32)) == OP_COMPLETE) {
return g_c1rcobj(op, hcon, arg);/* this return is a little */
/* subtle. As continuation */
/* routines call each other */
HALF_CONNECTION hcon;
struct robj_data *arg;
{
-#ifdef vax
- extern u_long ntohl();
-#endif vax
-
/*
* Now we know the length of the encoded data, convert the length
* to local byte order, and allocate the space for the receive.
*/
- arg->len = (int) ntohl((u_long)arg->len);
+ arg->len = (int) ntohl((uint32)arg->len);
if (arg->len > 65536)
return OP_CANCELLED;
db_free((char *)arg, sizeof(struct robj_data)); /* free the state structure */
return OP_COMPLETE;
}
-\f
+
+
/************************************************************************/
/*
/* complete_operation(complete_operation)
}
-\f
+
/************************************************************************/
/*
/* cancel_operation(cancel_operation)
return OP_CANCELLED;
}
-\f
+
+
/************************************************************************/
/*
/* start_listening
/*
/*----------------------------------------------------------*/
+/*ARGSUSED*/
int
g_clis(op, hcon, arg)
OPERATION op;
return OP_COMPLETE;
}
-\f
+
/************************************************************************/
/*
/* start_accepting_client
/*
/*----------------------------------------------------------*/
+/*ARGSUSED*/
int
g_iacc(op, hcon, arg)
OPERATION op;
/*
/*----------------------------------------------------------*/
+/*ARGSUSED*/
int
g_i2acc(op, hcon, arg)
OPERATION op;