JunkBox_Lib 1.10.1
Loading...
Searching...
No Matches
isnet.c
Go to the documentation of this file.
1
10#ifdef CPLUSPLUS
11 #undef CPLUSPLUS
12#endif
13
14
15#include "isnet.h"
16
17
18#ifdef ENABLE_SSL
19
20
22// コマンド受信処理
23//
24
37{
38 unsigned int i;
39 Buffer com;
40
41 com = cawk_Buffer(msg, ' ', 1);
42 if (com.buf==NULL) {
43 com = make_Buffer(1);
44 return com;
45 }
46
47 for (i=0; i<strlen((const char*)com.buf); i++) {
48 if (com.buf[i]>='a' && com.buf[i]<='z') com.buf[i] += - 'a' + 'A';
49 }
50 return com;
51}
52
53
66{
67 Buffer opr;
68
69 opr = cawk_Buffer(msg, ' ', 2);
70 if (opr.buf==NULL) opr = make_Buffer(1);
71
72 return opr;
73}
74
75
88{
89 int i, j, pos, cnt;
90 char* buf;
91 Buffer com;
92
93 buf = (char*)msg.buf;
94 for(i=0, j=0; j<2; j++) {
95 while (buf[i]!='\0' && buf[i]!=' ') i++;
96 while (buf[i]!='\0' && buf[i]==' ') i++;
97 }
98
99 pos = i;
100 while (buf[i]!='\0') i++;
101 cnt = i - pos;
102 com = make_Buffer(cnt+1);
103
104 if (com.buf==NULL) com = make_Buffer(1);
105 else {
106 for (i=0; i<cnt; i++) com.buf[i] = buf[pos+i];
107 com.vldsz = cnt;
108 }
109
110 return com;
111}
112
113
114#include "isnet_server.c"
115
116#include "isnet_client.c"
117
118
119#endif // ENABLE_SSL
Buffer make_Buffer(int sz)
Buffer型変数のバッファ部をつくり出す.
Definition buffer.c:71
Buffer cawk_Buffer(Buffer str, char cc, int n)
Buffer文字列に対する(変形の)awk.
Definition buffer.c:1094
Buffer get_comment(Buffer msg)
Definition isnet.c:87
Buffer get_operand(Buffer msg)
Definition isnet.c:65
Buffer get_command(Buffer msg)
Definition isnet.c:36
ISNETプロトコル用ライブラリ ヘッダ
unsigned char ** buf
Definition jpeg_tool.h:96
int vldsz
データの長さ.バイナリデータの場合も使用可能.文字列の場合は 0x00 を含まない.
Definition buffer.h:37
unsigned char * buf
バッファの先頭へのポインタ.str[bufsz]は必ず 0x00となる.
Definition buffer.h:39