JunkBox_Lib  1.10.2
https_tool.c
Go to the documentation of this file.
1 
7 #ifdef CPLUSPLUS
8  #undef CPLUSPLUS
9 #endif
10 
11 
12 #include "https_tool.h"
13 
14 
15 #ifdef ENABLE_SSL
16 
34 int send_https_header(int sofd, SSL* ssl, tList* pp, int mode)
35 {
36  int hs=0, sz=0;
37  Buffer buf;
38 
39  if (pp==NULL) return JBXL_ARGS_ERROR;
40 
41  buf = restore_protocol_header(pp, (char*)": ", mode, &hs);
42  if (buf.vldsz>0) {
43  sz = ssl_tcp_send_Buffer(sofd, ssl, &buf);
44  if (mode==ON) sz = sz - hs;
45  }
46 
47  free_Buffer(&buf);
48  return sz;
49 }
50 
51 
65 int send_https_Buffer(int sofd, SSL* ssl, tList* pl, Buffer* buf)
66 {
67  int sz;
68  Buffer snd;
69  /*
70  int nobody = FALSE;
71 
72  if (pl==NULL) return JBXL_ARGS_ERROR;
73  if (buf==NULL || buf->vldsz<0 || buf->buf==NULL) nobody = TRUE;
74 
75  if (!nobody) {
76  // Content-Length の書き換え
77  tList* pp = pl;
78  while(pp!=NULL) {
79  if (!strcasecmp((const char*)(pp->ldat.key.buf), "Content-Length")) {
80  copy_i2Buffer(buf->vldsz, &(pp->ldat.val));
81  break;
82  }
83  pp = pp->next;
84  }
85  }
86 
87  snd = restore_protocol_header(pl, (char*)": ", OFF, NULL);
88  if (!nobody) cat_Buffer(buf, &snd);
89 */
90  snd = rebuild_http_Buffer(pl, buf);
91  sz = ssl_tcp_send_Buffer(sofd, ssl, &snd);
92  free_Buffer(&snd);
93 
94  return sz;
95 }
96 
97 
112 int send_https_file(int sofd, SSL* ssl, tList* pl, const char* fname)
113 {
114  int sz = 0;
115  FILE* fp = NULL;
116  char num[20];
117  tList* pp;
118  unsigned char* html;
119  Buffer buf;
120 
121  size_t rs;
122  UNUSED(rs);
123 
124  if (pl==NULL) return JBXL_ARGS_ERROR;
125  if (fname!=NULL) sz = file_size((char*)fname);
126  if (sz<=0) sz = 0;
127  snprintf(num, 18, "%d", sz);
128 
129  // Content-Length の書き換え
130  pp = pl;
131  while(pp!=NULL) {
132  if (!strcasecmp((const char*)(pp->ldat.key.buf), "Content-Length")) {
133  copy_s2Buffer(num, &(pp->ldat.val));
134  break;
135  }
136  pp = pp->next;
137  }
138 
139  buf = restore_protocol_header(pl, (char*)": ", OFF, NULL);
140 
141  if (fname!=NULL && sz!=0) fp = fopen(fname, "rb");
142  if (fp!=NULL) {
143  html = (unsigned char*)malloc(sz+1);
144  if (html==NULL) {
145  fclose(fp);
146  free_Buffer(&buf);
147  return JBXL_MALLOC_ERROR;
148  }
149 
150  memset(html, 0, sz+1);
151  rs = fread(html, sz, 1, fp);
152  fclose(fp);
153 
154  cat_b2Buffer(html, &buf, sz);
155  free(html);
156  }
157 
158  sz = ssl_tcp_send_Buffer(sofd, ssl, &buf);
159  free_Buffer(&buf);
160 
161  return sz;
162 }
163 
164 
189 int recv_https_header(int sofd, SSL* ssl, tList** pl, int* len, int tm, FILE* fp, int* state)
190 {
191  int cc, sz, com;
192  Buffer mbuf;
193  tList* lp;
194  int connect = TRUE;
195 
196  if (sofd<=0) return JBXL_ARGS_ERROR;
197  if (len==NULL) return JBXL_ARGS_ERROR;
199 
200  mbuf = make_Buffer(RECVBUFSZ);
201 
202  sz = 0;
203  lp = NULL;
204  *pl = NULL;
205 
206  cc = ssl_tcp_recv_Buffer_wait(sofd, ssl, &mbuf, tm);
207  com = get_http_method((char*)mbuf.buf);
208 
209  if (com>HTTP_UNKNOWN_METHOD) {
210  Loop {
211  if (cc>0) {
212  if (fp!=NULL) fwrite(mbuf.buf, cc, 1, fp);
213  lp = get_protocol_header_list_seq(lp, mbuf, ':', TRUE, TRUE);
214  sz += cc;
215  /*
216  if (sz==cc) { // is HTTPS?
217  tList* ll = find_tList_top(lp);
218  if (get_http_header_method(ll)==HTTP_UNKNOWN_METHOD) {
219  connect = HTTP_HEADER_NOT_HTTP;
220  *pl = ll;
221  break;
222  }
223  }*/
224  }
225  else {
226  connect = FALSE;
227  break;
228  }
229 
230  *pl = find_tList_top(lp);
231  if (strncasecmp_tList(*pl, (char*)HDLIST_END_KEY, 0, 1)!=NULL) break;
232  //
233  cc = ssl_tcp_recv_Buffer_wait(sofd, ssl, &mbuf, tm);
234  }
235  }
236  else {
237  if (mbuf.vldsz>0) {
239  *pl = add_tList_node_Buffer(NULL, key, mbuf);
240  free_Buffer(&key);
241  }
243  connect = FALSE;
244  }
245 
246  free_Buffer(&mbuf);
247  if (*pl!=NULL) (*pl)->ldat.id = com;
248  if (state!=NULL) *state = connect;
249  //
250  if (sz==0 && cc==0) return 0; // 正常切断
251  if (sz==0 && cc<0) return JBXL_SSL_RECV_ERROR;
252  if (*pl==NULL) return JBXL_SSL_RECV_ERROR;
253  if (*len==HTTP_HEADER_NOT_HTTP) return cc;
254 
255  // コンテンツの長さを得る.
256  /*
257  Buffer hbuf = search_protocol_header(*pl, (char*)HDLIST_FIRST_LINE_KEY, 1);
258  if (hbuf.buf!=NULL) {
259  if (!strncasecmp((char*)hbuf.buf, "GET ", 4)) {
260  *len = 0;
261  }
262  free_Buffer(&hbuf);
263  }*/
264 
265  if (com==HTTP_GET_METHOD) *len = 0;
266 
268  if (is_http_header_field(*pl, (char*)"Transfer-Encoding", (char*)"chunked", 1)) {
270  }
271  }
272 
274  Buffer hbuf = search_protocol_header(*pl, (char*)"Content-Length", 1);
275  if (hbuf.buf!=NULL) {
276  *len = atoi((const char*)hbuf.buf);
277  free_Buffer(&hbuf);
278  }
279  }
280 
282  if (get_http_version_num(*pl)<=1.0 && get_http_status_num(*pl)>=200) {
283  if (is_http_header_field(*pl, (char*)"Connection", (char*)"close", 1)) {
285  }
286  }
287  }
288 
289  return sz;
290 }
291 
292 
311 int recv_https_content(int sofd, SSL* ssl, Buffer* buf, int len, int tm, FILE* fp, int* state)
312 {
313  int cc, sz;
314  Buffer rcv;
315 
316  if (state!=NULL) *state = TRUE;
317  sz = buf->vldsz;
318  if (sz>0 && fp!=NULL) fwrite(buf->buf, sz, 1, fp);
319 
320  // コンテンツの残りを受信
321  rcv = make_Buffer(RECVBUFSZ);
322  while(sz<len) {
323  //
324  cc = ssl_tcp_recv_Buffer_wait(sofd, ssl, &rcv, tm);
325  if (cc>0) {
326  if (fp!=NULL) fwrite(rcv.buf, cc, 1, fp);
327  cat_Buffer(&rcv, buf);
328  sz += cc;
329  }
330  else {
331  if (state!=NULL) *state = FALSE;
332  sz = cc;
333  break;
334  }
335  //memset(rcv.buf, 0, cc);
336  }
337 
338  free_Buffer(&rcv);
339  return sz;
340 }
341 
342 
360 int recv_https_chunked(int sofd, SSL* ssl, Buffer* buf, int tm, FILE* fp, int* state)
361 {
362  int cc, sz, i;
363  int chnksz, hdsz, tlsz;
364  if (state!=NULL) *state = TRUE;
365 
367 
368  sz = buf->vldsz;
369  if (sz<=0) { // chunk のサイズを含んだデータを読み込む
370  cc = ssl_tcp_recv_Buffer_wait(sofd, ssl, &tmp, tm);
371  if (cc<=0) {
372  if (state!=NULL) *state = FALSE;
373  free_Buffer(&tmp);
374  return cc;
375  }
376  }
377  else { // 既にコンテンツがある場合は tmpへ移動
378  cat_Buffer(buf, &tmp);
379  clear_Buffer(buf);
380  }
381 
382  //
383  chnksz = sz = get_chunked_size((char*)tmp.buf, &hdsz, &tlsz);
384 
385  while (chnksz>0) {
386  //
387  if (chnksz+hdsz+tlsz > tmp.vldsz) {
388  cc = recv_https_chunked_remain(sofd, ssl, &tmp, chnksz+hdsz+tlsz, tm);
389  if (cc<=0) {
390  sz = cc;
391  break;
392  }
393  }
394 
395  Buffer cat = tmp;
396  cat.buf = tmp.buf + hdsz;
397  cat.vldsz = chnksz;
398  cat_Buffer(&cat, buf);
399  //tmp.buf[tmp.vldsz] = '\0';
400 
401  // 次の chunk用にデータをつめる
402  for (i=0; i<tmp.vldsz-chnksz-hdsz-tlsz; i++) {
403  tmp.buf[i] = tmp.buf[chnksz + hdsz + tlsz + i];
404  }
405  tmp.vldsz = tmp.vldsz - chnksz - hdsz - tlsz;
406  //tmp.buf[tmp.vldsz] = '\0';
407 
408  if (tmp.vldsz==0) {
409  cc = ssl_tcp_recv_Buffer_wait(sofd, ssl, &tmp, tm);
410  if (cc<=0) {
411  sz = cc;
412  break;
413  }
414  }
415  chnksz = get_chunked_size((char*)tmp.buf, &hdsz, &tlsz);
416  sz += chnksz;
417  }
418 
419  if (fp!=NULL) fwrite(buf->buf, buf->vldsz, 1, fp);
420 
421  free_Buffer(&tmp);
422  return sz;
423 }
424 
425 
440 int recv_https_chunked_remain(int sofd, SSL* ssl, Buffer* buf, int chnksz, int tm)
441 {
442  int cc = 0;
443  int sz = buf->vldsz;
444  if (chnksz<=sz) return 0;
445 
447 
448  while (chnksz>sz) {
449  //memset(rcv.buf, 0, cc);
450  cc = ssl_tcp_recv_Buffer_wait(sofd, ssl, &rcv, tm);
451  if (cc<=0) {
452  sz = cc;
453  break;
454  }
455  cat_Buffer(&rcv, buf);
456  sz += cc;
457  }
458 
459  free_Buffer(&rcv);
460  return sz;
461 }
462 
463 
481 int recv_https_closed(int sofd, SSL* ssl, Buffer* buf, int tm, FILE* fp)
482 {
483  int cc, sz, tout;
484  Buffer rcv;
485 
486  sz = buf->vldsz;
487 
488  rcv = make_Buffer(RECVBUFSZ);
489  while ((tout=recv_wait(sofd, tm))) {
490  cc = ssl_tcp_recv_Buffer_wait(sofd, ssl, &rcv, tm);
491  if (cc>0) {
492  if (fp!=NULL) fwrite(rcv.buf, cc, 1, fp);
493  cat_Buffer(&rcv, buf);
494  sz += cc;
495  }
496  else {
497  break;
498  }
499  //memset(rcv.buf, 0, cc);
500  }
501  free_Buffer(&rcv);
502 
503  if (!tout) return JBXL_NET_RECV_TIMEOUT;
504 
505  return sz;
506 }
507 
508 
529 int recv_https_Buffer(int sofd, SSL* ssl, tList** pl, Buffer* buf, int tsecond, int* hdonly, int* state, int nochunk)
530 {
531  int cc=0, hs, len;
532  int connect;
533  Buffer cnt;
534  tList* lp;
535 
536  if (buf==NULL || buf->buf==NULL) return JBXL_ARGS_ERROR;
537  if (hdonly!=NULL) *hdonly = FALSE;
538 
539  clear_Buffer(buf);
540 
541  // ヘッダの受信
542  hs = recv_https_header(sofd, ssl, &lp, &len, tsecond, NULL, &connect);
543  if (state!=NULL) *state = connect;
544  if (hs<=0) return hs; // エラー
545  if (len==0 || len==HTTP_HEADER_UNKNOWN_LEN) { // ヘッダのみ
546  if (hdonly!=NULL) *hdonly = TRUE;
547  if (pl!=NULL) *pl = lp;
548  else del_tList(&lp);
549  return hs;
550  }
551 
552  // ヘッダ中に紛れ込んだコンテンツの取り出し
553  cnt = search_protocol_header(lp, (char*)HDLIST_CONTENTS_KEY, 1);
554  if (cnt.buf!=NULL) {
555  cc = cnt.vldsz;
556  hs = hs - cc;
557  copy_Buffer(&cnt, buf);
558  free_Buffer(&cnt);
559  }
560 
561  if (lp!=NULL && lp->ldat.id==HTTP_UNKNOWN_METHOD) { // not HTTP
562  *pl = lp;
563  return cc;
564  }
565 
566  // コンテンツの受信
567  if (connect) {
568  if (len>0) {
569  cc = recv_https_content(sofd, ssl, buf, len, tsecond, NULL, &connect);
570  }
571  else if (len==HTTP_HEADER_CHUNKED) {
572  connect = HTTP_HEADER_CHUNKED;
573  if (!nochunk) {
574  cc = recv_https_chunked(sofd, ssl, buf, tsecond, NULL, &connect);
575  }
576  }
577  else { //if (len==HTTP_HEADER_CLOSED_SESSION) {
578  cc = recv_https_closed(sofd, ssl, buf, tsecond, NULL);
579  connect = FALSE;
580  }
581  }
582 
583  // for Chunked
584  if (!nochunk && is_http_header_field(lp, (char*)"Transfer-Encoding", (char*)"chunked", 1)) {
585  delete_protocol_header(&lp, (char*)"Transfer-Encoding", 0);
586  char* str = itostr_ts(cc);
587  add_protocol_header(lp, (char*)"Content-Length", str);
588  freeNull(str);
589  }
590 
591  if (pl!=NULL) *pl = lp;
592  else del_tList(&lp);
593 
594  if (cc>0) cc = cc + hs;
595 
596  if (state!=NULL) *state = connect;
597  return cc;
598 }
599 
600 
620 int recv_https_file(int sofd, SSL* ssl, tList** pl, const char* fname, const char* wdir, int tsecond, int* hdonly, int* state)
621 {
622  int cc=0, hs, len;
623  Buffer buf, cnt;
624  FILE* fp = NULL;
625  const char tmpd[] = "/tmp";
626  int connect;
627 
628  if (hdonly!=NULL) *hdonly = FALSE;
629 
630  // ヘッダの受信
631  hs = recv_https_header(sofd, ssl, pl, &len, tsecond, NULL, &connect);
632  if (state!=NULL) *state = connect;
633  if (hs<=0) return hs; // エラー
634  if (len==0 || len==HTTP_HEADER_UNKNOWN_LEN) { // ヘッダのみ
635  if (hdonly!=NULL) *hdonly = TRUE;
636  return hs;
637  }
638 
639  //PRINT_MESG("++ RECV HEADER ++++++++++\n");
640  //print_tList(stderr, *pl);
641  //PRINT_MESG("+++++++++++++++++++++++++\n");
642 
643  // ヘッダ中に紛れ込んだコンテンツの取り出し
645  cnt = search_protocol_header(*pl, (char*)HDLIST_CONTENTS_KEY, 1);
646  if (cnt.buf!=NULL) {
647  /*DEBUG_MODE {
648  if (len==HTTP_HEADER_CHUNKED) {
649  char* line = get_line((char*)cnt.buf, 1);
650  int chnksz = hexstr2i(line);
651  PRINT_MESG("RECV_HTTPS_FILE: INFO: Chunk Size in Header = %d\n", chnksz);
652  freeNull(line);
653  }
654  }*/
655  cc = cnt.vldsz;
656  hs = hs - cc;
657  copy_Buffer(&cnt, &buf);
658  free_Buffer(&cnt);
659  }
660 
661  // コンテンツの受信
662  if (connect) {
663  if (len>0) {
664  cc = recv_https_content(sofd, ssl, &buf, len, tsecond, NULL, &connect);
665  }
666  else if (len==HTTP_HEADER_CHUNKED) {
667  cc = recv_https_chunked(sofd, ssl, &buf, tsecond, NULL, &connect);
668  //PRINT_MESG("+++++++++ RECVSZ = %d\n", buf.vldsz);
669  }
670  else { //if (len==HTTP_HEADER_CLOSED_SESSION) {
671  cc = recv_https_closed(sofd, ssl, &buf, tsecond, NULL);
672  connect = FALSE;
673  }
674  }
675 
676  if (cc>0) {
677  // コンテンツをファイルへ保存
678  if (fname!=NULL) fp = fopen(fname, "wb");
679  if (fp!=NULL) {
680  fwrite(buf.buf, buf.vldsz, 1, fp);
681  fclose(fp);
682  }
683  free_Buffer(&buf);
684 
685  //
686  if (fname!=NULL) {
687  buf = search_protocol_header(*pl, (char*)"Content-Encoding", 1);
688 
689  // Encoding 処理
690  if (buf.buf!=NULL) {
691  // gzip or deflate
692  if (!strncasecmp((const char*)buf.buf, "gzip", 4) ||
693  !strncasecmp((const char*)buf.buf, "deflate", 7)) {
694  #ifdef DISABLE_ZLIB
695  DEBUG_MODE PRINT_MESG("RECV_HTTPS_FILE: WARNING: Content-Encoding is [%s]. But zlib is not installed!!\n", buf.buf);
696  #else
697  if (wdir==NULL) wdir = tmpd;
698  cc = gz_decode_file_replace(fname, wdir);
699  delete_protocol_header(pl, (char*)"Content-Encoding", 0);
700 
701  // for chunked
702  if (is_http_header_field(*pl, (char*)"Transfer-Encoding", (char*)"chunked", 1)) {
703  delete_protocol_header(pl, (char*)"Transfer-Encoding", 0);
704  char* str = itostr_ts(cc);
705  add_protocol_header(*pl, (char*)"Content-Length", str);
706  freeNull(str);
707  }
708  #endif
709  }
710 
711  else {
712  DEBUG_MODE PRINT_MESG("RECV_HTTPS_FILE: WARNING: unknown Content-Encoding [%s]\n", buf.buf);
713  }
714  free_Buffer(&buf);
715  }
716 
717  // No Encofing
718  else {
719  // for chunked
720  if (is_http_header_field(*pl, (char*)"Transfer-Encoding", (char*)"chunked", 1)) {
721  delete_protocol_header(pl, (char*)"Transfer-Encoding", 0);
722  char* str = itostr_ts(cc);
723  add_protocol_header(*pl, (char*)"Content-Length", str);
724  freeNull(str);
725  }
726  }
727  }
728  cc = cc + hs;
729  }
730 
731  if (state!=NULL) *state = connect;
732  return cc;
733 }
734 
735 
755 int save_https_xml(int cofd, SSL* ssl, tList** pl, tXML** xml, char** recvfn, const char* wdir, int timeout, int* state)
756 {
757  int header;
758 
759  if (pl==NULL || recvfn==NULL) return 0;
760 
761  *pl = NULL;
762  if (xml!=NULL) *xml = NULL;
763  *recvfn = temp_filename(wdir, WORK_FILENAME_LEN);
764 
765  int cc = recv_https_file(cofd, ssl, pl, *recvfn, wdir, timeout, &header, state);
766  if (cc<=0 || *pl==NULL) {
767  free(*recvfn);
768  *recvfn = NULL;
769  if (cc==0) return 0;
770  return JBXL_SSL_RECV_ERROR;
771  }
772 
773  if (header) {
774  free(*recvfn);
775  *recvfn = NULL;
776  }
777  else {
778 
779  if (xml!=NULL && *pl!=NULL && *recvfn!=NULL && cc>0) {
780  Buffer buf = search_protocol_header(*pl, (char*)"Content-Type", 1);
781  *xml = xml_parse_file(*recvfn);
782  if (*xml!=NULL && (*xml)->state<0) del_all_xml(xml);
783  free_Buffer(&buf);
784  }
785  }
786 
787  return cc;
788 }
789 
790 
791 #endif // ENABLE_SSL
Buffer make_Buffer(int sz)
Buffer型変数のバッファ部をつくり出す.
Definition: buffer.c:71
int cat_b2Buffer(void *src, Buffer *dst, int len)
任意のバイナリデータsrcを Buffer型変数dstへ lenバイト catする.
Definition: buffer.c:585
void clear_Buffer(Buffer *str)
Buffer型変数 のバッファ部を 0クリアする.
Definition: buffer.c:272
void free_Buffer(Buffer *buf)
Buffer型変数のバッファ部を解放する
Definition: buffer.c:128
int cat_Buffer(Buffer *src, Buffer *dst)
Buffer変数 srcから dstへバッファを catする.
Definition: buffer.c:384
int copy_Buffer(Buffer *src, Buffer *dst)
Buffer型変数 srcから dstへバッファをコピーする.
Definition: buffer.c:315
#define copy_s2Buffer(src, dst)
copy_b2Buffer()
Definition: buffer.h:108
#define make_Buffer_str(str)
set_Buffer()
Definition: buffer.h:61
#define OFF
Definition: common.h:231
#define Loop
Definition: common.h:256
#define RECVBUFSZ
256K
Definition: common.h:134
#define UNUSED(x)
Definition: common.h:264
#define TRUE
Definition: common.h:226
#define FALSE
Definition: common.h:223
#define WORK_FILENAME_LEN
Definition: common.h:179
#define ON
Definition: common.h:230
int gz_decode_file_replace(const char *fn, const char *tempdir)
ファイル名による ファイルの解凍.ファイルを置き換える.
Definition: gz_tool.c:358
Buffer rebuild_http_Buffer(tList *pl, Buffer *buf)
Definition: http_tool.c:74
int get_chunked_size(char *ptr, int *hdsz, int *tlsz)
Definition: http_tool.c:981
int get_http_method(char *data)
Definition: http_tool.c:837
int is_http_header_field(tList *pl, char *field, char *value, int n)
Definition: http_tool.c:877
float get_http_version_num(tList *pl)
Definition: http_tool.c:1421
int get_http_status_num(tList *pl)
Definition: http_tool.c:1401
#define HTTP_HEADER_CHUNKED
Definition: http_tool.h:26
#define HTTP_HEADER_CLOSED_SESSION
Definition: http_tool.h:25
#define HTTP_GET_METHOD
Definition: http_tool.h:34
#define HTTP_UNKNOWN_METHOD
0 固定.これ以下はエラーとする.
Definition: http_tool.h:31
#define HTTP_HEADER_NOT_HTTP
Definition: http_tool.h:24
#define HTTP_HEADER_UNKNOWN_LEN
Definition: http_tool.h:27
HTTPS ツールライブラリ ヘッダ
#define JBXL_ARGS_ERROR
不正な引数(NULLなど)
Definition: jbxl_state.h:42
#define JBXL_SSL_RECV_ERROR
SSL 受信エラー
Definition: jbxl_state.h:122
#define JBXL_MALLOC_ERROR
メモリ確保エラー
Definition: jbxl_state.h:41
#define JBXL_NET_RECV_TIMEOUT
受信タイムアウト
Definition: jbxl_state.h:76
unsigned char ** buf
Definition: jpeg_tool.h:96
unsigned char unsigned long * len
Definition: jpeg_tool.h:96
int recv_wait(int sock, int tm)
Definition: network.c:1443
Buffer search_protocol_header(tList *list, char *key, int no)
Definition: protocol.c:372
tList * get_protocol_header_list_seq(tList *lp, Buffer buf, char deli, int fstline, int rcntnt)
Definition: protocol.c:181
Buffer restore_protocol_header(tList *list, char *deli, int mode, int *hdsz)
Definition: protocol.c:55
#define delete_protocol_header(p, k, n)
Definition: protocol.h:54
#define HDLIST_CONTENTS_KEY
Definition: protocol.h:32
#define HDLIST_END_KEY
Definition: protocol.h:34
#define add_protocol_header(p, k, v)
Definition: protocol.h:51
int ssl_tcp_recv_Buffer_wait(int sock, SSL *ssl, Buffer *str, int tm)
Definition: ssl_tool.c:1920
int ssl_tcp_send_Buffer(int sock, SSL *ssl, Buffer *str)
Definition: ssl_tool.c:1881
Definition: buffer.h:35
int vldsz
データの長さ.バイナリデータの場合も使用可能.文字列の場合は 0x00 を含まない.
Definition: buffer.h:37
unsigned char * buf
バッファの先頭へのポインタ.str[bufsz]は必ず 0x00となる.
Definition: buffer.h:39
tList * strncasecmp_tList(tList *pl, const char *key, int len, int no)
char* 型変数によるノードのサーチ.大文字小文字を無視する
Definition: tlist.c:1094
tList * del_tList(tList **pp)
指定したリストノード以降のリストを削除.
Definition: tlist.c:735
tList * find_tList_top(tList *pl)
リストの最初のノードを探す.
Definition: tlist.c:1002
#define add_tList_node_Buffer(p, k, v)
add_tList_node_byBuffer()
Definition: tlist.h:144
unsigned long int file_size(const char *fn)
ファイルの大きさを返す.
Definition: tools.c:2309
char * itostr_ts(int n)
int を文字に変換する.要 free()
Definition: tools.c:1532
char * temp_filename(const char *dir, int flen)
/dev/urandom を利用して作業用ファイルのランダムなファイル名を得る.
Definition: tools.c:2397
#define freeNull(p)
Definition: tools.h:201
#define PRINT_MESG
環境依存用の出力関数.print_message()
Definition: tools.h:475
#define DEBUG_MODE
Definition: tools.h:502
tXML * xml_parse_file(const char *fn)
ファイルから読み込んでパースする.
Definition: txml.c:94
#define del_all_xml(p)
XMLツリーの全ノードの削除.ポインタ ppのノードを含むXMLツリー全体を削除する.
Definition: txml.h:205