|
JunkBox_Lib
1.10.2
|
MIMEツール ヘッダ More...
#include "xtools.h"

Go to the source code of this file.
Macros | |
| #define | MIME_CONTENT_LINE "Content-" |
| #define | MIME_CONTENTTYPE_LINE "Content-Type" |
| #define | MIME_CONTENTDSPO_LINE "Content-Disposition" |
| #define | MIME_NAMEEQ_LINE "name=" |
| #define | MIME_FILENAMEEQ_LINE "filename=" |
| #define | MIME_FILENAMESTAR_LINE "filename*" |
| #define | MIME_BOUNDARY_LINE "boundary=" |
| #define | MIME_ISO2022JP_LINE "ISO-2022-JP" |
| #define | MIME_BASE64 "=?ISO-2022-JP?B?" |
| #define | MIME_QUTDPRNTBL "" |
| #define | MIME_RFC2231 "iso-2022-jp'ja'" |
| #define | MIME_CHARSET_ISO2022JP "Content-Type: text/plain; charset=iso-2022-jp" |
| #define | MIME_ERR_ENCODE -1 |
| #define | MIME_UNKNOWN_ENCODE 0 |
| #define | MIME_BASE64_ENCODE 1 |
| #define | MIME_QUTDPRNTBL_ENCODE 2 |
| #define | MIME_URL_ENCODE 3 |
Functions | |
| char * | get_mime_boundary (tList *list) |
| tList * | get_mime_filename (FILE *fp, char *bndry) |
| tList * | get_mime_filenameffn (char *fn, char *bndry) |
| char * | decode_mime_string (char *str) |
| char * | decode_mime_rfc2047 (char *str) |
| char * | decode_mime_rfc2231 (char *str) |
| char * | encode_mime_string (char *str, int kind) |
| int | get_mime_enckind (char *str) |
Definition in file mime_tool.h.
| #define MIME_BASE64 "=?ISO-2022-JP?B?" |
Definition at line 21 of file mime_tool.h.
| #define MIME_BASE64_ENCODE 1 |
Definition at line 28 of file mime_tool.h.
| #define MIME_BOUNDARY_LINE "boundary=" |
Definition at line 19 of file mime_tool.h.
| #define MIME_CHARSET_ISO2022JP "Content-Type: text/plain; charset=iso-2022-jp" |
Definition at line 24 of file mime_tool.h.
| #define MIME_CONTENT_LINE "Content-" |
Definition at line 13 of file mime_tool.h.
| #define MIME_CONTENTDSPO_LINE "Content-Disposition" |
Definition at line 15 of file mime_tool.h.
| #define MIME_CONTENTTYPE_LINE "Content-Type" |
Definition at line 14 of file mime_tool.h.
| #define MIME_ERR_ENCODE -1 |
Definition at line 26 of file mime_tool.h.
| #define MIME_FILENAMEEQ_LINE "filename=" |
Definition at line 17 of file mime_tool.h.
| #define MIME_FILENAMESTAR_LINE "filename*" |
Definition at line 18 of file mime_tool.h.
| #define MIME_ISO2022JP_LINE "ISO-2022-JP" |
Definition at line 20 of file mime_tool.h.
| #define MIME_NAMEEQ_LINE "name=" |
Definition at line 16 of file mime_tool.h.
| #define MIME_QUTDPRNTBL "" |
Definition at line 22 of file mime_tool.h.
| #define MIME_QUTDPRNTBL_ENCODE 2 |
Definition at line 29 of file mime_tool.h.
| #define MIME_RFC2231 "iso-2022-jp'ja'" |
Definition at line 23 of file mime_tool.h.
| #define MIME_UNKNOWN_ENCODE 0 |
Definition at line 27 of file mime_tool.h.
| #define MIME_URL_ENCODE 3 |
Definition at line 30 of file mime_tool.h.
| char* decode_mime_rfc2047 | ( | char * | mime | ) |
char* decode_mime_rfc2047(char* mime)
RFC2047で定義された文字列をデコードする.文字列全体が," " で括られていても可.
文字列中には余分な空白は無く,行間はCR+LF(またはLF)で区切られているものとする. エンコードされていない文字列が混在してもデコード可.
| mime | デコードされる文字列. |
Definition at line 181 of file mime_tool.c.
References awk(), buf, CHAR_CR, CHAR_LF, decode_base64(), decode_quoted_printable(), len, and MIME_ISO2022JP_LINE.
Referenced by decode_mime_string().


| char* decode_mime_rfc2231 | ( | char * | mime | ) |
char* decode_mime_rfc2231(char* mime)
mime の内容を MIME + RFC2231 としてデコードする.
mimeには余分な空白,ダブルクォーテーション は無く,行間は ;+CR+LF(またはCR+LF,またはLF)で 区切られているものとする. つまり,mime は filename*#*= 以下の部分に相当.
| mime | デコードされる文字列. |
Definition at line 312 of file mime_tool.c.
References awk(), buf, CHAR_CR, CHAR_LF, decode_urlenc(), and MIME_ISO2022JP_LINE.
Referenced by decode_mime_string().


| char* decode_mime_string | ( | char * | mime | ) |
char* decode_mime_string(char* mime)
MIME文字列をデコードする.文字列が " で括られている場合は " を削除する. また,文字列中の CR, LF は無視する.
Definition at line 361 of file mime_tool.c.
References buf, CHAR_CR, CHAR_LF, decode_mime_rfc2047(), decode_mime_rfc2231(), get_mime_enckind(), len, MIME_BASE64_ENCODE, MIME_ERR_ENCODE, MIME_QUTDPRNTBL_ENCODE, MIME_UNKNOWN_ENCODE, and MIME_URL_ENCODE.
Referenced by get_mime_filename().


| char* encode_mime_string | ( | char * | str, |
| int | kind | ||
| ) |
char* encode_mime_string(char* str, int kind)
MIME でエンコードする(一行分のみ).
| str | エンコードする文字データ. |
| kind | MIME_BASE64_ENCODE MIME + BASE64 |
| kind | MIME_QUTDPRNTBL_ENCODE MIME + quoted printable |
| kind | MIME_URL_ENCODE RFC2231 (URL encode) |
Definition at line 444 of file mime_tool.c.
References buf, Buffer::buf, cat_s2Buffer, copy_s2Buffer, encode_base64(), encode_quoted_printable(), encode_urlenc(), free_Buffer(), LBUF, make_Buffer(), MIME_BASE64, MIME_BASE64_ENCODE, MIME_QUTDPRNTBL, MIME_QUTDPRNTBL_ENCODE, MIME_RFC2231, and MIME_URL_ENCODE.

| char* get_mime_boundary | ( | tList * | list | ) |
char* get_mime_boundary(tList* list)
ヘッダリスト list から mime boundary を探し出す.
mime boundary 自身は先頭に '--' が付加されて返される.
| list | ヘッダリスト |
Definition at line 27 of file mime_tool.c.
References buf, free_Buffer(), MIME_BOUNDARY_LINE, MIME_CONTENTTYPE_LINE, and search_protocol_header_value().

| int get_mime_enckind | ( | char * | mime | ) |
int get_mime_enckind(char* mime)
MIME文字列 からエンコードの種類を獲得する.文字列は " " で括られていても可.
文字列の間には余分な空白は無く,行間は(存在すれば)CR+LF(またはLF)で区切 られているものとする.
| mime | 検査される文字列. |
| MIME_ERR_ENCDE | (-1) エラー |
| MIME_UNKNOWN_ENCODE | ( 0) 不明もしくはエンコードなし. |
| MIME_BASE64_ENCODE | ( 1) MIME + BASE64 |
| MIME_QUTDPRNTBL_ENCODE | ( 2) MIME + quoted printable |
| MIME_URL_ENCODE | ( 3) RFC2231 (URL encode) |
Definition at line 512 of file mime_tool.c.
References MIME_BASE64, MIME_BASE64_ENCODE, MIME_ERR_ENCODE, MIME_QUTDPRNTBL, MIME_QUTDPRNTBL_ENCODE, MIME_RFC2231, MIME_UNKNOWN_ENCODE, MIME_URL_ENCODE, and strstrcase().
Referenced by decode_mime_string().


| tList* get_mime_filename | ( | FILE * | fp, |
| char * | bndry | ||
| ) |
tList* get_mime_filename(FILE* fp, char* bndry)
ファイルから mime boundaryを探し出し,Content-Type行の内容をリストに格納して返す. 複数行に渡る場合も結合して返す.
| fp | ファイルポインタ |
| bndry | '––' + MIMEの境界文字列 |
Definition at line 67 of file mime_tool.c.
References add_tList_node_str, buf, Buffer::buf, decode_mime_string(), del_all_tList(), FALSE, fgets_Buffer(), find_tList_top(), free_Buffer(), get_protocol_header_list_seq(), init_Buffer(), LBUF, Loop, make_Buffer(), MIME_CONTENT_LINE, MIME_FILENAMESTAR_LINE, MIME_NAMEEQ_LINE, search_protocol_header(), and strstrcase().
Referenced by get_mime_filenameffn().


| tList* get_mime_filenameffn | ( | char * | fname, |
| char * | bndry | ||
| ) |
tList* get_mime_filenameffn(char* fname, char* bndry)
ファイルから mime boundaryを探し出し,CONTENT-TYPE行の内容をリストに格納して返す. 複数行に渡る場合も結合して返す.
| fname | ファイル名 |
| bndry | '––' + MIMEの境界文字列 |
Definition at line 153 of file mime_tool.c.
References get_mime_filename().
