Common Lisp Package: RFC2388-BINARY

README:

FUNCTION

Public

PARSE-HEADER-VALUE

Returns the value in header-value-string and any associated attributes.

PARSE-MIME (SOURCE BOUNDARY &KEY WRITE-CONTENT-TO-FILE (BYTE-ENCODER #'CODE-CHAR))

Parses MIME entities, returning them as a list. Each element in the list is of form: (body headers), where BODY is the contents of MIME part, and HEADERS are all headers for that part. BOUNDARY is a string used to separate MIME entities. This is the convenience interface to READ-MIME, all data is read into memory or a file and we assume that every byte in the data corresponds to exactly one character. The SOURCE and BOUNDARY arguments are passed unchanged to READ-MIME. See READ-MIME's documentation for details.

Undocumented

Private

AS-ASCII-CHAR (BYTE)

Assuming BYTE is an ASCII coded character retun the corresponding character.

LINEAR-WHITESPACE-BYTE? (BYTE)

In short: is it a space or a tab?

PARSE-KEY-VALUES

Returns an alist of the keys and values in KEY-VALUE-STRING. KEY-VALUE-STRING is of the form: (w+="w+";)*

READ-UNTIL-NEXT-BOUNDARY

Reads from STREAM up to the next boundary. For every byte of data in stream we call DATA-HANDLER passing it the byte. Returns T if there's more data to be read, NIL otherwise. The ASSUME-FIRST-BOUNDARY parameter should T if we're reading the first part of a MIME message, where there is no leading CR LF sequence.

Undocumented

ASCII-STRING-TO-BOUNDARY-ARRAY (STRING)

MAKE-MIME-BUFFER-WRITER (&KEY (BYTE-ENCODER #'CODE-CHAR))

MAKE-MIME-FILE-WRITER (FILE-NAME &KEY (BYTE-ENCODER #'CODE-CHAR))

MIME-PART-HEADERS-TO-ALIST (MIME-PART CONTENT)

MACRO

Private

Undocumented

DEBUG-MESSAGE (MESSAGE &REST MESSAGE-CONTROL)

GENERIC-FUNCTION

Public

GET-HEADER (PART HEADER-NAME)

Returns the mime-header object for the header named HEADER-NAME (a string).

GET-HEADER-ATTRIBUTE (HEADER NAME)

Returns the value of the attribute named NAME in the header HEADER.

READ-MIME (SOURCE BOUNDARY CALLBACK)

Parses the MIME entites in SOURCE. SOURCE is either a vector of (unsigned-byte 8) or a stream whose element-type is (unsigned-byte 8). BOUNDARY is either a string of US-ASCII encodeable characters or a byte vector. CALLBACK is a function which will be passed one argument, a MIME-PART containing the headers of the mime part and must return the following values: - a byte-handler function. This is a one argument function which will be passed every byte in the mime part's content. - a termination function. This is a function without arguments and will be called when the operation finishes without errors. It must return whatever is to be returned from read-mime. - an optional abort function. This is a function without arguments and will be called when the operation is aborted due to an error. READ-MIME consumes bytes from SOURCE and returns a list of the whatever the various termination functions returned. Example: (read-mime #<a binary stream> "123" (lambda (mime-part) (values (lambda (byte) (collect-byte-somewhere byte)) (lambda () mime-part)))) This call would return a list of mime-part objects passing each byte to collect-byte-somewhere. You may also want to look at UCW for a real-world example.

Undocumented

MIME-PART-P (OBJECT)

SLOT-ACCESSOR

Public

Undocumented

CONTENT (OBJECT)

SETFCONTENT (NEW-VALUE OBJECT)

CONTENT-CHARSET (OBJECT)

SETFCONTENT-CHARSET (NEW-VALUE OBJECT)

CONTENT-LENGTH (OBJECT)

SETFCONTENT-LENGTH (NEW-VALUE OBJECT)

CONTENT-TYPE (OBJECT)

SETFCONTENT-TYPE (NEW-VALUE OBJECT)

HEADER-ATTRIBUTES (OBJECT)

SETFHEADER-ATTRIBUTES (NEW-VALUE OBJECT)

HEADER-NAME (OBJECT)

SETFHEADER-NAME (NEW-VALUE OBJECT)

HEADER-VALUE (OBJECT)

SETFHEADER-VALUE (NEW-VALUE OBJECT)

HEADERS (OBJECT)

SETFHEADERS (NEW-VALUE OBJECT)

VARIABLE

Private

*DEBUG*

When T we compile the code with some logging statements built in.

CLASS

Public

Undocumented

MIME-PART

Private

Undocumented

MIME-HEADER