source: asp3_tinet_ecnl_rx/trunk/ntshell/src/fdtable.h@ 387

Last change on this file since 387 was 387, checked in by coas-nagasima, 5 years ago

ファイルディスクリプタ処理を更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 3.5 KB
Line 
1/*
2 * TOPPERS ECHONET Lite Communication Middleware
3 *
4 * Copyright (C) 2017 Cores Co., Ltd. Japan
5 *
6 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
7 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
8 * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
9 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
10 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
11 * スコード中に含まれていること.
12 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
13 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
14 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
15 * の無保証規定を掲載すること.
16 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
17 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
18 * と.
19 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
20 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
21 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
22 * 報告すること.
23 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
24 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
25 * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
26 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
27 * 免責すること.
28 *
29 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
30 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
31 * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
32 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
33 * の責任を負わない.
34 *
35 * @(#) $Id$
36 */
37#ifndef SOCKET_STUB_H
38#define SOCKET_STUB_H
39
40typedef const struct io_type_s IO_TYPE;
41
42struct SHELL_FILE {
43 int fd;
44 IO_TYPE *type;
45 int handle;
46 int readevt_r;
47 int readevt_w;
48 int writeevt_r;
49 int writeevt_w;
50 int writable;
51 int errorevt_r;
52 int errorevt_w;
53 void *exinf;
54};
55
56struct io_type_s {
57 int (*close)(struct SHELL_FILE *);
58 size_t (*read)(struct SHELL_FILE *, unsigned char *, size_t);
59 size_t (*write)(struct SHELL_FILE *, const unsigned char *, size_t);
60 off_t (*seek)(struct SHELL_FILE *, off_t, int);
61 int (*ioctl)(struct SHELL_FILE *, int, void *);
62 bool_t (*readable)(struct SHELL_FILE *);
63 bool_t (*writable)(struct SHELL_FILE *);
64 void (*delete)(struct SHELL_FILE *);
65};
66
67#ifndef bool
68#define bool int
69#endif
70#ifndef true
71#define true 1
72#endif
73#ifndef false
74#define false 0
75#endif
76
77struct SHELL_FILE *new_fp(IO_TYPE *type, int id, int writable);
78int delete_fd_by_id(IO_TYPE *type, int id);
79struct SHELL_FILE *fd_to_fp(int fd);
80struct SHELL_FILE *id_to_fd(IO_TYPE *type, int id);
81
82int delete_fp(struct SHELL_FILE *fp);
83void clean_fd();
84
85#endif // !SOCKET_STUB_H
Note: See TracBrowser for help on using the repository browser.