Changeset 55 for branches/home/psmith/restructure/src/protocol
- Timestamp:
- 01/29/07 02:35:58 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/home/psmith/restructure/src/protocol/yarpc/yarpc-packet-factory.lisp ¶
r53 r55 36 36 (make-instance 'yarpc-packet-factory)) 37 37 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+)) 40 46 41 47 (defmethod get-packet ((pf yarpc-packet-factory) buf) … … 57 63 (defclass call-method-packet (packet)((call-string :initarg :call-string 58 64 :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 66 65 (defun call-method-packet (call-string) 67 66 (make-instance 'call-method-packet :call-string call-string)) … … 71 70 72 71 (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 75 75 (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 ) 78 79 79 80 … … 90 91 (defmethod write-bytes((packet method-response-packet) buf) 91 92 #+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 93 95 (nio-buffer:bytebuffer-write-string buf (write-to-string (response packet))) 96 (nio-buffer:bytebuffer-insert-32 buf (buffer-position buf) 1) 94 97 #+nio-debug (format-log t "yarpc-packet-factory:write-bytes - written ~A~%" buf) 95 98 )
Note: See TracChangeset
for help on using the changeset viewer.