[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

converting DEFXDR to DEFINE-REMOTE-TYPE



    Date: Wed, 25 Jul 90 13:23:02 CDT
    From: aihaug@austin.lockheed.com (Daniel A Haug)

    (I've been waiting almost two days for customer support to initiate contact
    with me - any call at all - on getting help for this.  So, with a very
    critical deadline drawing close, I'm pleading to SLUG for help).

    I've been trying to port some remote procedure call code that was
    implemented using Genera 7.2 ILA's NFS system to Symbolics new Genera 8
    RPC layer.  I've had little trouble converting DEFRPCs into DEFINE-REMOTE-
    ENTRY forms.  My problem has been in converting DEFXDRs to DEFINE-REMOTE-
    TYPE forms.  Specifically, here is the xdr form that I'm trying to convert.
    It is a list of this format:  (list <string> <string> <int> <string>)

    DEFXDR using ILA's NFS in 7.2:

    (defxdr star-os-logical ()
      (xdrin-star-os-logical (xdr)
	(list (xdrin-string xdr)
	      (xdrin-string xdr)
	      (xdrin-long xdr)
	      (xdrin-string xdr)))
      (xdrout-star-os-logical (xdr star-os-logical)
	 (xdrout-string xdr (first star-os-logical))
	 (xdrout-string xdr (second star-os-logical))
	 (xdrout-long   xdr (third star-os-logical))
	 (xdrout-string xdr (fourth star-os-logical))))


    Here is my closest approximation to this:

    (define-remote-type star-os-logical ()
      (:lisp
	(:size (value) ...)
	(:send (star-os-logical)
	 `(progn
	    (send-char-vector (first ,star-os-logical))
	    (send-char-vector (second ,star-os-logical))
	    (send-word (third ,star-os-logical))
	    (send-char-vector (fourth ,star-os-logical))))
	(:receive ()
	  `(progn
	     (list (receive-char-vector ...)
		   (receive-char-vector ...)
		   (receive-word ...)
		   (receive-char-vector ...))))))


    Two things are causing me problems here.  First is specifying the
    :size option.  It is a variable size message, and I've seen that it
    wants me to compute the size of it (in XDR words) each time.  I have
    no idea how to do this.  I note that it must be exact, else the
    RPC module using this errors out by either not reading all of the
    XDR record, or reading too much of it.

    The second problem (or maybe just a hassle) is that the RECEIVE-CHAR-VECTOR
    expects you to pass in the vector for it to fill up.  This isn't as
    easy as was NFS:XDRIN-STRING which would simply return the string after
    reading it from the XDR stream. Is there an easier way to do this other
    than pregenerating character arrays, and subseq'ing from them at the
    conclusion of the read?

    Your help is appreciated,

This should work:

(defstruct (star-os-logical (:type list))
  first-string
  second-string
  long
  third-string)

(rpc:define-remote-type star-os-logical ()
  (:abbreviation-for
    '(structure (:lisp star-os-logical)
		(first-string rpc:string)
		(second-string rpc:string)
		(long rpc:integer-32)
		(third-string rpc:string))))