OSDN Git Service

クッキー取得ができない現象の調査中
[nlite/nlite.git] / nlib / nlib.h
1 #pragma once
2
3 #ifndef WIN32_LEAN_AND_MEAN
4 #define WIN32_LEAN_AND_MEAN
5 #endif
6
7 #include <Windows.h>
8 #include <qwerty\qwerty_common.h>
9 #include <shareCookie\browserType.h>
10 #include <winhttp.h>
11 #include "nlib_define.h"
12
13 #ifdef NLIB_EXPORTS
14
15
16 #define NLIB_DECLSPEC  __declspec(dllexport)
17
18 #else  //NLIB_EXPORTS
19
20 #ifdef NLIB_DYNAMIC
21 #define NLIB_DECLSPEC  __declspec(dllimport)
22 #else //NLIB_STATIC
23
24 #define NLIB_DECLSPEC extern
25
26 #endif
27
28
29
30 #endif //NLIB_EXPORTS
31
32 //\8c^\92è\8b`
33 //////////////////////////////////////////////////////////////////////////////////////////////////////
34
35
36
37
38 ///
39 ///nlib\82Ì\96ß\82è\92l\82Ì\8c^
40 ///
41 typedef UINT_PTR NLIB_RESULT;
42
43
44 ///
45 ///\83v\83\8d\83o\83C\83_\83^\83C\83v
46 ///
47 typedef UINT_PTR PROVIDERTYPE;
48
49
50 ///
51 ///NicoLiveStream\82Ì\83R\81[\83\8b\83o\83b\83N\8aÖ\90\94\82Ì\83C\83x\83\93\83g\83^\83C\83v\8c^
52 ///
53 typedef UINT_PTR                NICOLIVE_EVENT;
54
55 ///
56 ///NicoLiveStream\82Ì\83R\81[\83\8b\83o\83b\83N\8aÖ\90\94\82Ì\83p\83\89\83\81\81[\83^\83^\83C\83v
57 ///
58 typedef UINT_PTR                NICOLIVE_PARAM;
59
60
61 ///
62 ///NicoMyList\82Ì\83R\81[\83\8b\83o\83b\83N\8aÖ\90\94\82Ì\83C\83x\83\93\83g\83^\83C\83v\8c^
63 ///
64 typedef UINT_PTR                NICOMYLIST_EVENT;
65
66
67
68
69 ///
70 ///\83j\83R\83j\83R\90\95ú\91\97\83I\83u\83W\83F\83N\83g\83|\83C\83\93\83^
71 ///
72 typedef struct nicolivestream_t *NicoLiveStream_P;
73
74 ///
75 ///\83j\83R\83j\83R\93®\89æ\94F\8fØ\83I\83u\83W\83F\83N\83g
76 ///
77 typedef struct nicovideoauth_t *NicoVideoAuth_P;
78
79
80
81 ///
82 ///\83j\83R\83j\83R\90\95ú\91\97\83X\83e\81[\83^\83X
83 ///
84 //typedef struct streamstatus_t *StreamStatus_P;
85
86
87 ///
88 ///\83j\83R\83j\83R\90\95ú\91\97\8fî\95ñ\83I\83u\83W\83F\83N\83g
89 ///
90 //typedef struct streaminfo_t *StreamInfo_P;
91
92
93
94
95 ///
96 ///\83j\83R\83j\83R\93®\89æ\83}\83C\83\8a\83X\83g\83A\83C\83e\83\80\83I\83u\83W\83F\83N\83g
97 ///
98 typedef struct nicomylistitem_t *NicoMyListItem_P;
99
100 ///
101 ///\83j\83R\83j\83R\93®\89æ\83}\83C\83\8a\83X\83g\83A\83C\83e\83\80\83f\81[\83^\83I\83u\83W\83F\83N\83g
102 ///
103 typedef struct nicoitemdata_t *NicoItemData_P;
104
105 ///
106 ///\83j\83R\83j\83R\93®\89æ\82Ì\83}\83C\83\8a\83X\83g\83I\83u\83W\83F\83N\83g
107 ///
108 typedef struct nicomylist_t *NicoMyList_P;
109
110 ///
111 ///\83j\83R\83j\83R\90\95ú\91\97\83C\83x\83\93\83g\83n\83\93\83h\83\89
112 ///
113 typedef NLIB_RESULT (*NicoRecvCallBack)(NICOLIVE_EVENT eventType,NicoLiveStream_P pNicoLiveStream,LPVOID option,NICOLIVE_PARAM param1,NICOLIVE_PARAM param2);
114
115 ///
116 ///\83j\83R\83j\83R\83}\83C\83\8a\83X\83g\83C\83x\83\93\83g\83n\83\93\83h\83\89
117 ///
118 typedef NLIB_RESULT (*NicoMyListCallBack)(LPVOID option,NicoMyListItem_P pVideo);
119
120 ///
121 ///\83j\83R\83j\83R\83}\83C\83\8a\83X\83g\88ê\97\97\83C\83x\83\93\83g\83n\83\93\83h\83\89
122 ///
123 typedef NLIB_RESULT (*NicoMyListGroupCallBack)(LPVOID option,NicoMyList_P pMyList);
124
125
126 ///
127 ///\83j\83R\83j\83R\90\95ú\91\97\83`\83\83\83b\83g\83R\83\81\83\93\83g\8d\\91¢\91Ì
128 ///
129 typedef struct{
130         LPCTSTR premium;
131         LPCTSTR anonymity;
132         LPCTSTR thread;
133         LPCTSTR no;
134         LPCTSTR vpos;
135         LPCTSTR date;
136         LPCTSTR locale;
137         LPCTSTR user_id;
138         LPCTSTR name;
139         LPCTSTR chatBuf;
140         LPTSTR* mail;
141         UINT_PTR mailCount;
142 }NicoLiveChat,*NicoLiveChat_P;
143
144
145
146
147 ///
148 ///\83j\83R\83j\83R\90\95ú\91\97\83X\83\8c\83b\83h\83R\83\81\83\93\83g\8d\\91¢\91Ì
149 ///
150 typedef struct{
151         LPCTSTR thread;
152         LPCTSTR ticket;
153         LPCTSTR last_res;
154         time_t server_time;
155 }NicoLiveThreadComment,*NicoLiveThreadComment_P;
156
157
158 ///
159 ///\83j\83R\83j\83R\90\95ú\91\97\91\97\90M\8c\8b\89Ê\83R\83\81\83\93\83g\8d\\91¢\91Ì
160 ///
161 typedef struct{
162         LPCTSTR status;
163         LPCTSTR no;
164         LPCTSTR thread;
165 }NicoLiveSendResultComment,*NicoLiveSendResultComment_P;
166
167
168 ///
169 ///\83j\83R\90\83n\81[\83g\83r\81[\83g\8d\\91¢\91Ì
170 ///
171 typedef struct{
172
173         NLIB_RESULT status;
174
175         time_t time;
176
177         UINT_PTR watchCount;
178
179         UINT_PTR commentCount;
180
181         LPCTSTR is_restrict;
182
183         LPCTSTR ticket;
184
185
186 }NicoLiveHeartBeat,*NicoLiveHeartBeat_P;
187
188 namespace nlib{
189
190
191 ///
192 ///nlib\97á\8aO\8f\88\97\9d\83N\83\89\83X
193 ///
194 class Exception:public std::exception{
195                 
196 private:
197         std::wstring  wErrMessage;
198         UINT_PTR line;
199         std::wstring fileName;
200         std::wstring function;
201
202                 
203 public:
204         ///
205         ///\83R\83\93\83X\83g\83\89\83N\83^
206         ///
207         Exception();
208         Exception(const char* const& errMessage);
209         Exception(const wchar_t * const & errMessage,UINT_PTR in_line,LPCTSTR in_fileName,LPCTSTR in_function);
210                 
211                 
212         ///
213         ///\83G\83\89\81[\95\8c¾\8eæ\93¾
214         ///
215         LPCTSTR what();
216
217
218         ///
219         ///\83G\83\89\81[\94­\90\8ds\8eæ\93¾
220         ///
221         UINT_PTR getLineNo();
222
223         ///
224         ///\83G\83\89\81[\94­\90\83t\83@\83C\83\8b\96¼\8eæ\93¾
225         ///
226         LPCTSTR getFileName();
227
228
229         ///
230         ///\83G\83\89\81[\94­\90\8aÖ\90\94\96¼\82ð\8eæ\93¾
231         ///
232         LPCTSTR getFunctionName();
233
234 };
235 }
236
237
238 #ifdef __cplusplus
239 extern "C" {
240 #endif
241
242         
243         ///
244         ///nlib\8f\89\8aú\89»\8aÖ\90\94
245         ///
246         NLIB_DECLSPEC NLIB_RESULT InitializeNLIB(HINTERNET hInternet);
247
248         ///
249         ///nlib\8cã\8en\96\96\8aÖ\90\94
250         ///
251         NLIB_DECLSPEC VOID FinalizeNLIB();
252
253
254         ///
255         ///\83G\83\89\81[\83\81\83b\83Z\81[\83W\8eæ\93¾
256         ///
257         NLIB_DECLSPEC LPCTSTR NLIB_GetErrorMessage(NLIB_RESULT rsltCode);
258
259
260
261
262
263
264 //
265 //\83j\83R\83j\83R\90\95ú\91\97\8aÖ\98A\8aÖ\90\94
266 ////////////////////////////////////////////////////////////////////////////////////////////////////
267
268         
269         ///
270         ///\83j\83R\83j\83R\90\95ú\91\97\83I\83u\83W\83F\83N\83g\93®\93I\90\90¬
271         ///
272         NLIB_DECLSPEC NicoLiveStream_P NicoLiveStream_new();
273
274         ///
275         ///\93®\93I\82É\90\90¬\82µ\82½\83j\83R\83j\83R\90\95ú\91\97\83I\83u\83W\83F\83N\83g\82ð\94j\8aü
276         ///
277         NLIB_DECLSPEC VOID NicoLiveStream_delete(NicoLiveStream_P* self);
278
279         ///
280         ///\8ew\92è\82µ\82½URL\82Ì\95ú\91\97\82É\90Ú\91±
281         ///
282         NLIB_DECLSPEC NLIB_RESULT NicoLiveStream_connect(NicoLiveStream_P self,NicoVideoAuth_P nicoVideoAuth,LPCTSTR url,NicoRecvCallBack callback,LPVOID option);
283         
284
285         ///
286         ///\95ú\91\97\82Æ\82Ì\90Ú\91±\82ð\90Ø\92f\82·\82é
287         ///
288         NLIB_DECLSPEC VOID NicoLiveStream_disConnect(NicoLiveStream_P self);
289
290         ///
291         ///\90Ú\91±\8e\9e\82Ì\8eó\90M\82·\82é\83R\83\81\83\93\83g\90\94\82ð\90Ý\92è
292         ///
293         NLIB_DECLSPEC VOID NicoLiveStrream_setResFrom(NicoLiveStream_P self,INT_PTR res);
294
295
296         ///
297         ///\90Ú\91±\8e\9e\82Ì\8eó\90M\82·\82é\83R\83\81\83\93\83g\90\94\82ð\8eæ\93¾
298         ///
299         NLIB_DECLSPEC INT_PTR NicoLiveStream_getResFrom(NicoLiveStream_P self);
300
301         ///
302         ///\83n\81[\83g\83r\81[\83g\82Ì\8aÔ\8au\82ð\90Ý\92è\81i\83~\83\8a\95b)
303         ///
304         NLIB_DECLSPEC VOID NicoLiveStream_setHeartBeatMsec(NicoLiveStream_P self,DWORD msec);
305
306
307         ///
308         ///\83n\81[\83g\83r\81[\83g\82Ì\8aÔ\8au\82ð\8eæ\93¾(\83~\83\8a\95b)
309         ///
310         NLIB_DECLSPEC DWORD NicoLiveStream_getHeartBeatMsec(NicoLiveStream_P self);
311
312         ///
313         ///\83n\81[\83g\83r\81[\83g\97L\8cø\81E\96³\8cø\90Ý\92è
314         ///
315         NLIB_DECLSPEC VOID NicoLiveStream_setHeartBeatFlag(NicoLiveStream_P self,BOOL flag);
316
317
318         ///
319         ///\83n\81[\83g\83r\81[\83g\97L\8cø\83t\83\89\83O\8eæ\93¾
320         ///
321         NLIB_DECLSPEC BOOL NicoLiveStream_getHeartBeatFlag(NicoLiveStream_P self);
322
323         ///
324         ///\83L\81[\83v\83A\83\89\83C\83u\82Ì\8aÔ\8au\82ð\90Ý\92è(\83~\83\8a\95b)
325         ///
326         NLIB_DECLSPEC VOID NicoLiveStream_setKeapALiveMsec(NicoLiveStream_P self,DWORD msec);
327
328         ///
329         ///\83L\81[\83v\83A\83\89\83C\83u\82Ì\8aÔ\8au\82ð\8eæ\93¾(\83~\83\8a\95b)
330         ///
331         NLIB_DECLSPEC DWORD NicoLiveStream_getKeapALiveMsec(NicoLiveStream_P self);
332
333
334         ///
335         ///\83L\81[\83v\83A\83\89\83C\83u\97L\8cø\81E\96³\8cø\90Ý\92è
336         ///
337         NLIB_DECLSPEC VOID NicoLiveStream_setKeapALiveFlag(NicoLiveStream_P self,BOOL flag);
338
339
340         ///
341         ///\83L\81[\83v\83A\83\89\83C\83u\83t\83\89\83O\8eæ\93¾
342         ///
343         NLIB_DECLSPEC BOOL NicoLiveStream_getKeapALiveFlag(NicoLiveStream_P self);
344
345
346         ///
347         ///\90\95ú\91\97\83X\83e\81[\83^\83X\8eæ\93¾
348         ///
349 //      NLIB_DECLSPEC StreamStatus_P NicoLiveStream_getStreamStatus(NicoLiveStream_P self);
350
351         ///
352         ///\83R\83\81\83\93\83g\91\97\90M
353         ///
354         NLIB_DECLSPEC NLIB_RESULT NicoLiveStream_sendChat(NicoLiveStream_P self,LPCTSTR chatbuf,LPCTSTR *mail,LPCTSTR *extends);
355
356         ///
357         ///\83n\81[\83g\83r\81[\83g\91\97\90M
358         ///
359         NLIB_DECLSPEC NLIB_RESULT NicoLiveStream_sendHeartBeat(NicoLiveStream_P self);
360
361
362         ///
363         ///\90Ú\91±\92\86\82Ì\95ú\91\97\8fî\95ñ\82ð\96â\82¢\8d\87\82í\82¹\82é
364         ///
365 //      NLIB_DECLSPEC StreamInfo_P NicoLiveStream_queryStreamInfo(NicoLiveStream_P self);
366
367
368         ///
369         ///\83X\83g\83\8a\81[\83\80\83X\83e\81[\83^\83X\82ÌID\82ð\8eæ\93¾
370         ///
371         NLIB_DECLSPEC LPCTSTR NicoLiveStream_getId(NicoLiveStream_P self);
372
373
374         ///
375         ///\83X\83g\83\8a\81[\83\80\83X\83e\81[\83^\83X\82Ì\83R\83~\83\85\83j\83e\83B\94Ô\8d\86\82ð\8eæ\93¾
376         ///
377         NLIB_DECLSPEC LPCTSTR NicoLiveStream_getDefaultCommunity(NicoLiveStream_P self);
378
379
380         ///
381         ///\83X\83g\83\8a\81[\83\80\83X\83e\81[\83^\83X\82Ì\83v\83\8d\83o\83C\83_\83^\83C\83v\82ð\8eæ\93¾
382         ///
383         NLIB_DECLSPEC PROVIDERTYPE NicoLiveStream_getProviderType(NicoLiveStream_P self);
384
385
386         ///
387         ///\83X\83g\83\8a\81[\83\80\83X\83e\81[\83^\83X\82Ì\83I\81[\83i\81[\83t\83\89\83O\82ð\8eæ\93¾
388         ///
389         NLIB_DECLSPEC BOOL NicoLiveStream_isOwner(NicoLiveStream_P self);
390
391         ///
392         ///\83X\83g\83\8a\81[\83\80\83X\83e\81[\83^\83X\82Ì\8aJ\8en\8e\9e\8d\8f\82ð\8eæ\93¾
393         ///
394         NLIB_DECLSPEC time_t NicoLiveStream_getStartTime(NicoLiveStream_P self);
395
396         ///
397         ///\83X\83g\83\8a\81[\83\80\83X\83e\81[\83^\83X\82Ì\8fI\97¹\8e\9e\8d\8f\82ð\8eæ\93¾
398         ///
399         NLIB_DECLSPEC time_t NicoLiveStream_getEndTime(NicoLiveStream_P self);
400
401         ///
402         ///\83X\83g\83\8a\81[\83\80\83X\83e\81[\83^\83X\82Ì\8aJ\8fê\8e\9e\8d\8f\82ð\8eæ\93¾
403         ///
404         NLIB_DECLSPEC time_t NicoLiveStream_getOpenTime(NicoLiveStream_P self);
405
406         ///
407         ///\83X\83g\83\8a\81[\83\80\83X\83e\81[\83^\83X\82Ì\83x\81[\83X\8e\9e\8d\8f\82ð\8eæ\93¾
408         ///
409         NLIB_DECLSPEC time_t NicoLiveStream_getBaseTime(NicoLiveStream_P self);
410
411
412         ///
413         ///\83X\83g\83\8a\81[\83\80\83X\83e\81[\83^\83X\82Ì\83^\83C\83g\83\8b\8eæ\93¾
414         ///
415         NLIB_DECLSPEC LPCTSTR NicoLiveStream_getTitle(NicoLiveStream_P self);
416
417
418         ///
419         ///\83v\83\8c\83~\83A\83\80\83t\83\89\83O\82Ì\8eæ\93¾
420         ///
421         NLIB_DECLSPEC BOOL NicoLiveStream_isPremium(NicoLiveStream_P self);
422
423         //
424         //\83j\83R\83j\83R\93®\89æ\94F\8fØ\8aÖ\98A\8aÖ\90\94
425         /////////////////////////////////////////////////////////////////////////////////////////////////
426         
427         ///
428         ///\83j\83R\83j\83R\93®\89æ\94F\8fØ\83I\83u\83W\83F\83N\83g\90\90¬
429         ///
430         NLIB_DECLSPEC NicoVideoAuth_P NicoVideoAuth_new();
431
432         ///
433         ///\83j\83R\83j\83R\93®\89æ\94F\8fØ\83I\83u\83W\83F\83N\83g\94j\8aü
434         ///
435         NLIB_DECLSPEC VOID NicoVideoAuth_delete(NicoVideoAuth_P *self);
436
437
438         ///
439         ///\83\86\81[\83U\81[\83Z\83b\83V\83\87\83\93\8eæ\93¾
440         ///
441         NLIB_DECLSPEC LPCTSTR NicoVideoAuth_getUserSession(NicoVideoAuth_P self);
442
443         ///
444         ///\83j\83R\83j\83R\93®\89æ\94F\8fØ\8fî\95ñ\8eæ\93¾
445         ///
446         NLIB_DECLSPEC NLIB_RESULT NicoVideoAuth_getNicoVideoAuth(NicoVideoAuth_P self,BROWSERTYPE browserType);
447
448
449         //
450         //\83j\83R\83j\83R\93®\89æ\83}\83C\83\8a\83X\83g\8aÖ\98A\8aÖ\90\94
451         ////////////////////////////////////////////////////////////////////////////////////////////////////
452
453         ///
454         ///\82Æ\82è\82 \82¦\82¸\83}\83C\83\8a\83X\83g\88ê\97\97\8eæ\93¾
455         ///
456         NLIB_DECLSPEC NLIB_RESULT NicoMyList_getDefList(NicoVideoAuth_P pAuth,NicoMyListCallBack callback,LPVOID option);
457
458         ///
459         ///\83}\83C\83\8a\83X\83g\8eæ\93¾
460         ///
461         NLIB_DECLSPEC NLIB_RESULT NicoMyList_getMyList(NicoVideoAuth_P pAuth,LPCTSTR id,NicoMyListCallBack callback,LPVOID option);
462
463         ///
464         ///\83}\83C\83\8a\83X\83g\83O\83\8b\81[\83v\8eæ\93¾
465         ///
466         NLIB_DECLSPEC NLIB_RESULT NicoMyList_getMyListGroup(NicoVideoAuth_P pAuth,NicoMyListGroupCallBack callback,LPVOID option);
467
468
469         ///
470         ///\83}\83C\83\8a\83X\83g\93o\98^\8cÄ\82Ñ\8fo\82µ
471         /// 
472         NLIB_DECLSPEC NLIB_RESULT NicoMyList_addItem(LPCTSTR video_id);
473
474
475
476
477
478
479 #ifdef __cplusplus
480 }
481 #endif
482
483
484
485 #pragma comment(lib,"Wininet.lib")
486 #pragma comment(lib,"WinHttp.lib")
487 #pragma comment(lib,"Iepmapi.lib")
488 #pragma comment(lib,"ws2_32.lib")
489 #pragma comment(lib, "shell32.lib" )
490 #pragma comment(lib,"expat.lib")
491 #pragma comment(lib,"sqlite3.lib")
492 #pragma comment(lib,"sqliteManager.lib")
493 #pragma comment(lib,"shareCookie.lib")
494 #pragma comment(lib,"winmm.lib")
495 #pragma comment(lib,"JSONParser.lib")