Ignore:
Timestamp:
01/29/07 02:35:58 (18 years ago)
Author:
psmith
Message:

large packet support first working version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified branches/home/psmith/restructure/src/protocol/yarpc/yarpc-packet-factory.lisp

    r53 r55  
    3636  (make-instance 'yarpc-packet-factory))     
    3737
    38 (defconstant CALL-METHOD-PACKET-ID #x0)
    39 (defconstant METHOD-RESPONSE-PACKET-ID #x1)
     38(defconstant +CALL-METHOD-PACKET-ID+ #x0)
     39(defconstant +METHOD-RESPONSE-PACKET-ID+ #x1)
     40
     41(defconstant +PACKET-ID-SIZE+ 1)
     42(defconstant +PACKET-LENGTH-SIZE+ 4)
     43
     44(defconstant +yarpc-packet-header-size+
     45  (+ +PACKET-ID-SIZE+ +PACKET-LENGTH-SIZE+))
    4046
    4147(defmethod get-packet ((pf yarpc-packet-factory) buf)
     
    5763(defclass call-method-packet (packet)((call-string :initarg :call-string
    5864                                            :accessor call-string)))
    59 
    60 (defconstant +PACKET-ID-SIZE+ 1)
    61 (defconstant +PACKET-LENGTH-SIZE+ 4)
    62 
    63 (defconstant +yarpc-packet-header-size+
    64   (+ +PACKET-ID-SIZE+ +PACKET-LENGTH-SIZE+))
    65 
    6665(defun call-method-packet (call-string)
    6766  (make-instance 'call-method-packet :call-string call-string))
     
    7170
    7271(defmethod write-bytes((packet call-method-packet) buf)
    73 #+nio-debug  (format-log t "yarpc-packet-factory:write-bytes - writing ~A to ~A~%" packet buf)
    74   (nio-buffer:bytebuffer-write-vector buf #(#x0))
     72  #+nio-debug  (format-log t "yarpc-packet-factory:write-bytes(call-method-packet) - writing ~%~A to ~%~A~%" packet buf)
     73  (nio-buffer:bytebuffer-write-8 buf +CALL-METHOD-PACKET-ID+)
     74  (nio-buffer:bytebuffer-write-32 buf 0) ; come back and write length later
    7575  (nio-buffer:bytebuffer-write-string buf (call-string packet))
    76 #+nio-debug    (format-log t "yarpc-packet-factory:write-bytes - written ~A~%" buf) 
    77 )
     76  (nio-buffer:bytebuffer-insert-32 buf (buffer-position buf) 1)
     77  #+nio-debug    (format-log t "yarpc-packet-factory:write-bytes(call-method-packet) - written ~%~A ~%" buf) 
     78  )
    7879 
    7980
     
    9091(defmethod write-bytes((packet method-response-packet) buf)
    9192#+nio-debug    (format-log t "yarpc-packet-factory:write-bytes - writing ~A to ~A~%" packet buf)
    92   (nio-buffer:bytebuffer-write-vector buf #(#x1))
     93  (nio-buffer:bytebuffer-write-8 buf +METHOD-RESPONSE-PACKET-ID+)
     94  (nio-buffer:bytebuffer-write-32 buf 0) ; come back and write length later
    9395  (nio-buffer:bytebuffer-write-string buf (write-to-string (response packet)))
     96  (nio-buffer:bytebuffer-insert-32 buf (buffer-position buf) 1)
    9497#+nio-debug    (format-log t "yarpc-packet-factory:write-bytes - written ~A~%" buf) 
    9598)
Note: See TracChangeset for help on using the changeset viewer.