1 /* MiniDLNA media server
2  * Copyright (C) 2013-2017  NETGEAR
3  *
4  * This file is part of MiniDLNA.
5  *
6  * MiniDLNA is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * MiniDLNA is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with MiniDLNA. If not, see <http://www.gnu.org/licenses/>.
17  */
18 #ifndef __CLIENTS_H__
19 #define __CLIENTS_H__
20 #include <stdint.h>
21 #include <sys/time.h>
22 #include <netinet/in.h>
23 
24 #define CLIENT_CACHE_SLOTS 25
25 
26 /* Client capability/quirk flags */
27 #define FLAG_DLNA               0x00000001
28 #define FLAG_MIME_AVI_DIVX      0x00000002
29 #define FLAG_MIME_AVI_AVI       0x00000004
30 #define FLAG_MIME_FLAC_FLAC     0x00000008
31 #define FLAG_MIME_WAV_WAV       0x00000010
32 #define FLAG_RESIZE_THUMBS      0x00000020
33 #define FLAG_NO_RESIZE          0x00000040
34 #define FLAG_MS_PFS             0x00000080 /* Microsoft PlaysForSure client */
35 #define FLAG_SAMSUNG            0x00000100
36 #define FLAG_SAMSUNG_DCM10      0x00000200
37 #define FLAG_AUDIO_ONLY         0x00000400
38 #define FLAG_FORCE_SORT         0x00000800
39 #define FLAG_CAPTION_RES        0x00001000
40 #define FLAG_SKIP_DLNA_PN       0x00002000 /* during browsing */
41 #define FLAG_CONVERT_MS         0x00004000 /* convert ms to s */
42 /* Response-related flags */
43 #define FLAG_HAS_CAPTIONS       0x10000000
44 #define RESPONSE_TRUNCATED      0x80000000
45 #define RESPONSE_FLAGS          0xF0000000
46 
47 enum match_types {
48 	EMatchNone,
49 	EUserAgent,
50 	EXAVClientInfo,
51 	EFriendlyName,
52 	EModelName,
53 	EFriendlyNameSSDP
54 };
55 
56 enum client_types {
57 	EXbox = 1,
58 	EPS3,
59 	EDenonReceiver,
60 	EDirecTV,
61 	EFreeBox,
62 	ELGDevice,
63 	ELGNetCastDevice,
64 	ELifeTab,
65 	EMarantzDMP,
66 	EMediaRoom,
67 	ENetgearEVA2000,
68 	EPanasonic,
69 	EPopcornHour,
70 	ERokuSoundBridge,
71 	ESamsungSeriesA,
72 	ESamsungSeriesB,
73 	ESamsungSeriesCDEBDP,
74 	ESamsungSeriesQ,
75 	ESamsungSeriesCDE,
76 	ESamsungBDJ5500,
77 	ESonyBDP,
78 	ESonyBravia,
79 	ESonyInternetTV,
80 	EToshibaTV,
81 	EHyundaiTV,
82 	EAsusOPlay,
83 	EBubbleUPnP,
84 	ENetFrontLivingConnect,
85 	EKodi,
86 	EMovian,
87 	EStandardDLNA150,
88 	EStandardUPnP
89 };
90 
91 struct client_type_s {
92 	enum client_types type;
93 	uint32_t flags;
94 	const char *name;
95 	const char *match;
96 	enum match_types match_type;
97 };
98 
99 struct client_cache_s {
100 	struct in_addr addr;
101 	unsigned char mac[6];
102 	struct client_type_s *type;
103 	time_t age;
104 	int connections;
105 };
106 
107 extern struct client_type_s client_types[];
108 extern struct client_cache_s clients[CLIENT_CACHE_SLOTS];
109 
110 struct client_cache_s *SearchClientCache(struct in_addr addr, int quiet);
111 struct client_cache_s *AddClientCache(struct in_addr addr, int type);
112 
113 #endif
114