Document of c-modernization-kit (porter) 1.0.0
Loading...
Searching...
No Matches
porter.h
Go to the documentation of this file.
1
16
17#ifndef PORTER_H
18#define PORTER_H
19
20#include <porter_type.h>
21
22#ifdef DOXYGEN
23
37#define POTR_EXPORT
38
46#define POTR_API
47
48#else /* !DOXYGEN */
49
50#ifndef _WIN32
51 #define POTR_EXPORT
52 #define POTR_API
53#else /* _WIN32 */
54 #ifndef __INTELLISENSE__
55 #ifndef POTR_STATIC
56 #ifdef POTR_EXPORTS
57 #define POTR_EXPORT __declspec(dllexport)
58 #else /* !POTR_EXPORTS */
59 #define POTR_EXPORT __declspec(dllimport)
60 #endif /* POTR_EXPORTS */
61 #else /* POTR_STATIC */
62 #define POTR_EXPORT
63 #endif /* POTR_STATIC */
64 #else /* __INTELLISENSE__ */
65 #define POTR_EXPORT
66 #endif /* __INTELLISENSE__ */
67 #ifndef POTR_API
68 #define POTR_API __stdcall
69 #endif /* POTR_API */
70#endif /* _WIN32 */
71
72#endif /* DOXYGEN */
73
74#ifdef __cplusplus
75extern "C"
76{
77#endif /* __cplusplus */
78
183 POTR_EXPORT extern int POTR_API potrOpenService(const PotrGlobalConfig *global,
184 const PotrServiceDef *service,
185 PotrRole role,
186 PotrRecvCallback callback,
187 PotrHandle *handle);
188
267 POTR_EXPORT extern int POTR_API potrOpenServiceFromConfig(const char *config_path,
268 int64_t service_id,
269 PotrRole role,
270 PotrRecvCallback callback,
271 PotrHandle *handle);
272
342 POTR_EXPORT extern int POTR_API potrSend(PotrHandle handle,
343 PotrPeerId peer_id,
344 const void *data,
345 size_t len,
346 int flags);
347
374 PotrPeerId peer_id);
375
403
463 const char *log_file,
464 int console);
465
500 POTR_EXPORT extern int POTR_API potrGetServiceType(const char *config_path,
501 int64_t service_id,
502 PotrType *type);
503
504#ifdef __cplusplus
505}
506#endif /* __cplusplus */
507
508#endif /* PORTER_H */
POTR_EXPORT int POTR_API potrGetServiceType(const char *config_path, int64_t service_id, PotrType *type)
設定ファイルから指定サービスの通信種別を取得します。
POTR_EXPORT int POTR_API potrLogConfig(PotrLogLevel level, const char *log_file, int console)
ロガーを設定します。
Definition potrLog.c:72
#define POTR_API
呼び出し規約マクロ。
Definition porter.h:46
POTR_EXPORT int POTR_API potrSend(PotrHandle handle, PotrPeerId peer_id, const void *data, size_t len, int flags)
メッセージを送信します。
Definition potrSend.c:88
POTR_EXPORT int POTR_API potrOpenService(const PotrGlobalConfig *global, const PotrServiceDef *service, PotrRole role, PotrRecvCallback callback, PotrHandle *handle)
設定構造体から指定サービスを開きます。
POTR_EXPORT int POTR_API potrDisconnectPeer(PotrHandle handle, PotrPeerId peer_id)
指定ピアを切断します (N:1 モード専用)。
POTR_EXPORT int POTR_API potrOpenServiceFromConfig(const char *config_path, int64_t service_id, PotrRole role, PotrRecvCallback callback, PotrHandle *handle)
設定ファイルから指定サービスを開きます。
POTR_EXPORT int POTR_API potrCloseService(PotrHandle handle)
サービスを閉じます。
#define POTR_EXPORT
DLL エクスポート/インポート制御マクロ。
Definition porter.h:37
通信ライブラリの型定義ファイル。
PotrLogLevel
ログレベル。
void(* PotrRecvCallback)(int64_t service_id, PotrPeerId peer_id, PotrEvent event, const void *data, size_t len)
受信コールバック関数型 (全通信種別共通)。
PotrType
通信種別。
Definition porter_type.h:85
struct PotrContext_ * PotrHandle
セッションハンドル。
PotrRole
役割種別。
uint32_t PotrPeerId
ピア識別子。
Definition porter_type.h:32
グローバル設定。
サービス定義。