Cedar.h 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267
  1. // SoftEther VPN Source Code - Stable Edition Repository
  2. // Cedar Communication Module
  3. //
  4. // SoftEther VPN Server, Client and Bridge are free software under GPLv2.
  5. //
  6. // Copyright (c) Daiyuu Nobori.
  7. // Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
  8. // Copyright (c) SoftEther Corporation.
  9. //
  10. // All Rights Reserved.
  11. //
  12. // http://www.softether.org/
  13. //
  14. // Author: Daiyuu Nobori, Ph.D.
  15. // Comments: Tetsuo Sugiyama, Ph.D.
  16. //
  17. // This program is free software; you can redistribute it and/or
  18. // modify it under the terms of the GNU General Public License
  19. // version 2 as published by the Free Software Foundation.
  20. //
  21. // This program is distributed in the hope that it will be useful,
  22. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. // GNU General Public License for more details.
  25. //
  26. // You should have received a copy of the GNU General Public License version 2
  27. // along with this program; if not, write to the Free Software
  28. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  29. //
  30. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  31. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  32. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  33. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  34. // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  35. // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  36. // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  37. //
  38. // THE LICENSE AGREEMENT IS ATTACHED ON THE SOURCE-CODE PACKAGE
  39. // AS "LICENSE.TXT" FILE. READ THE TEXT FILE IN ADVANCE TO USE THE SOFTWARE.
  40. //
  41. //
  42. // THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN,
  43. // UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY,
  44. // MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS
  45. // SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS
  46. // SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER
  47. // CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL
  48. // DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING,
  49. // MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR
  50. // SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND
  51. // CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO
  52. // EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO,
  53. // JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION
  54. // AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN
  55. // THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE.
  56. //
  57. // USE ONLY IN JAPAN. DO NOT USE THIS SOFTWARE IN ANOTHER COUNTRY UNLESS
  58. // YOU HAVE A CONFIRMATION THAT THIS SOFTWARE DOES NOT VIOLATE ANY
  59. // CRIMINAL LAWS OR CIVIL RIGHTS IN THAT PARTICULAR COUNTRY. USING THIS
  60. // SOFTWARE IN OTHER COUNTRIES IS COMPLETELY AT YOUR OWN RISK. THE
  61. // SOFTETHER VPN PROJECT HAS DEVELOPED AND DISTRIBUTED THIS SOFTWARE TO
  62. // COMPLY ONLY WITH THE JAPANESE LAWS AND EXISTING CIVIL RIGHTS INCLUDING
  63. // PATENTS WHICH ARE SUBJECTS APPLY IN JAPAN. OTHER COUNTRIES' LAWS OR
  64. // CIVIL RIGHTS ARE NONE OF OUR CONCERNS NOR RESPONSIBILITIES. WE HAVE
  65. // NEVER INVESTIGATED ANY CRIMINAL REGULATIONS, CIVIL LAWS OR
  66. // INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENTS IN ANY OF OTHER 200+
  67. // COUNTRIES AND TERRITORIES. BY NATURE, THERE ARE 200+ REGIONS IN THE
  68. // WORLD, WITH DIFFERENT LAWS. IT IS IMPOSSIBLE TO VERIFY EVERY
  69. // COUNTRIES' LAWS, REGULATIONS AND CIVIL RIGHTS TO MAKE THE SOFTWARE
  70. // COMPLY WITH ALL COUNTRIES' LAWS BY THE PROJECT. EVEN IF YOU WILL BE
  71. // SUED BY A PRIVATE ENTITY OR BE DAMAGED BY A PUBLIC SERVANT IN YOUR
  72. // COUNTRY, THE DEVELOPERS OF THIS SOFTWARE WILL NEVER BE LIABLE TO
  73. // RECOVER OR COMPENSATE SUCH DAMAGES, CRIMINAL OR CIVIL
  74. // RESPONSIBILITIES. NOTE THAT THIS LINE IS NOT LICENSE RESTRICTION BUT
  75. // JUST A STATEMENT FOR WARNING AND DISCLAIMER.
  76. //
  77. //
  78. // SOURCE CODE CONTRIBUTION
  79. // ------------------------
  80. //
  81. // Your contribution to SoftEther VPN Project is much appreciated.
  82. // Please send patches to us through GitHub.
  83. // Read the SoftEther VPN Patch Acceptance Policy in advance:
  84. // http://www.softether.org/5-download/src/9.patch
  85. //
  86. //
  87. // DEAR SECURITY EXPERTS
  88. // ---------------------
  89. //
  90. // If you find a bug or a security vulnerability please kindly inform us
  91. // about the problem immediately so that we can fix the security problem
  92. // to protect a lot of users around the world as soon as possible.
  93. //
  94. // Our e-mail address for security reports is:
  95. // softether-vpn-security [at] softether.org
  96. //
  97. // Please note that the above e-mail address is not a technical support
  98. // inquiry address. If you need technical assistance, please visit
  99. // http://www.softether.org/ and ask your question on the users forum.
  100. //
  101. // Thank you for your cooperation.
  102. //
  103. //
  104. // NO MEMORY OR RESOURCE LEAKS
  105. // ---------------------------
  106. //
  107. // The memory-leaks and resource-leaks verification under the stress
  108. // test has been passed before release this source code.
  109. // Cedar.h
  110. // Header of Cedar.c
  111. #ifndef CEDAR_H
  112. #define CEDAR_H
  113. //////////////////////////////////////////////////////////////////////
  114. //
  115. // Products related constants
  116. //
  117. //////////////////////////////////////////////////////////////////////
  118. // Replace the function name
  119. #ifdef VPN_SPEED
  120. #define DecryptSecurePacket __dsp
  121. #define CreateSecurePacket __csp
  122. #define GetSecureRandomSize __gsrs
  123. #endif // VPN_SPEED
  124. #define bool UINT
  125. #define BOOL UINT
  126. // Version number
  127. #define CEDAR_VER 428
  128. // Build Number
  129. #define CEDAR_BUILD 9669
  130. // Beta number
  131. //#define BETA_NUMBER 3
  132. // RC or not
  133. #define RELEASE_CANDIDATE
  134. // Specify the name of the person in charge building
  135. #ifndef BUILDER_NAME
  136. #define BUILDER_NAME "yagi"
  137. #endif // BUILDER_NAME
  138. // Specify the location to build
  139. #ifndef BUILD_PLACE
  140. #define BUILD_PLACE "pc33"
  141. #endif // BUILD_PLACE
  142. // Specifies the build date
  143. #define BUILD_DATE_Y 2018
  144. #define BUILD_DATE_M 9
  145. #define BUILD_DATE_D 11
  146. #define BUILD_DATE_HO 11
  147. #define BUILD_DATE_MI 48
  148. #define BUILD_DATE_SE 34
  149. // Tolerable time difference
  150. #define ALLOW_TIMESTAMP_DIFF (UINT64)(3 * 24 * 60 * 60 * 1000)
  151. // Configuration of communication related control switch
  152. #define USE_DOS_ATTACK_DETECTION // Enable the DOS attack detection
  153. //#define USE_SECURE_PACKET // Enable the scrambled packet
  154. // Designate the IDS detection signatures
  155. #define CEDAR_SIGNATURE_STR "SE-VPN4-PROTOCOL"
  156. // Default RSA certificate name of the smart card
  157. #define SECURE_DEFAULT_CERT_NAME "VPN_RSA_CERT"
  158. // Default RSA private key name of the smart card
  159. #define SECURE_DEFAULT_KEY_NAME "VPN_RSA_KEY"
  160. // Hidden password string of 8 characters
  161. #define HIDDEN_PASSWORD "********"
  162. //////////////////////////////////////////////////////////////////////
  163. //
  164. // Definition of the maximum length of various string
  165. //
  166. //////////////////////////////////////////////////////////////////////
  167. #define MAX_ACCOUNT_NAME_LEN 255 // Maximum account name length
  168. #define MAX_USERNAME_LEN 255 // User name maximum length
  169. #define MAX_PASSWORD_LEN 255 // Password name maximum length
  170. #define MAX_PROXY_USERNAME_LEN 255 // Proxy user name maximum length
  171. #define MAX_PROXY_PASSWORD_LEN 255 // Proxy Password maximum length
  172. #define MAX_SERVER_STR_LEN 255 // Maximum length of server string
  173. #define MAX_CLIENT_STR_LEN 255 // Maximum length of client string
  174. #define MAX_HUBNAME_LEN 255 // Maximum length of HUB name
  175. #define MAX_SESSION_NAME_LEN 255 // Session name maximum length
  176. #define MAX_CONNECTION_NAME_LEN 255 // Maximum length of connection name
  177. #define MAX_DEVICE_NAME_LEN 31 // Device name maximum length
  178. #define MAX_DEVICE_NAME_LEN_9X 4 // Maximum length of Virtual LAN card name in Win9x
  179. #define MAX_ACCESSLIST_NOTE_LEN 255 // Maximum length of the note of access list entry
  180. #define MAX_SECURE_DEVICE_FILE_LEN 255 // Secure device file name maximum length
  181. #define MAX_ADMIN_OPTION_NAME_LEN 63 // Management option name
  182. #define MAX_REDIRECT_URL_LEN 255 // URL length to redirect
  183. //////////////////////////////////////////////////////////////////////
  184. //
  185. // Server and session management related constants
  186. //
  187. //////////////////////////////////////////////////////////////////////
  188. #define SERVER_MAX_SESSIONS 4096 // Maximum number of sessions that the server supports
  189. #define SERVER_MAX_SESSIONS_FOR_CARRIER_EDITION 100000 // Maximum number of sessions that the server supports (Carrier Edition)
  190. #define NAT_MAX_SESSIONS 4096 // Maximum number of sessions that are supported by NAT
  191. #define NAT_MAX_SESSIONS_KERNEL 65536 // Maximum number of sessions that are supported by NAT (In the case of kernel-mode NAT)
  192. #define MAX_HUBS 4096 // The maximum number of virtual HUB
  193. #define MAX_HUBS_FOR_CARRIER_EDITION 100000 // The maximum number of virtual HUB (Carrier Edition)
  194. #define MAX_ACCESSLISTS (4096 * 8) // Maximum number of access list entries
  195. #define MAX_USERS 10000 // The maximum number of users
  196. #define MAX_GROUPS 10000 // Maximum number of groups
  197. #define MAX_MAC_TABLES VPN_GP(GP_MAX_MAC_TABLES, 65536) // Maximum number of MAC address table entries
  198. #define MAX_IP_TABLES VPN_GP(GP_MAX_IP_TABLES, 65536) // Maximum number of IP address table entries
  199. #define MAX_HUB_CERTS 4096 // Maximum number of Root CA that can be registered
  200. #define MAX_HUB_CRLS 4096 // Maximum number of CRL that can be registered
  201. #define MAX_HUB_ACS 4096 // Maximum number of AC that can be registered
  202. #define MAX_HUB_LINKS VPN_GP(GP_MAX_HUB_LINKS, 1024) // Maximum number of Cascade that can be registered
  203. #define MAX_HUB_ADMIN_OPTIONS 4096 // Maximum number of Virtual HUB management options that can be registered
  204. #ifndef USE_STRATEGY_LOW_MEMORY
  205. #define MEM_FIFO_REALLOC_MEM_SIZE VPN_GP(GP_MEM_FIFO_REALLOC_MEM_SIZE, (65536 * 10))
  206. #define QUEUE_BUDGET VPN_GP(GP_QUEUE_BUDGET, 2048)
  207. #define FIFO_BUDGET VPN_GP(GP_FIFO_BUDGET, 1600 * 1600 * 4)
  208. #else // USE_STRATEGY_LOW_MEMORY
  209. #define MEM_FIFO_REALLOC_MEM_SIZE VPN_GP(GP_MEM_FIFO_REALLOC_MEM_SIZE, (65536))
  210. #define QUEUE_BUDGET VPN_GP(GP_QUEUE_BUDGET, 1024)
  211. #define FIFO_BUDGET VPN_GP(GP_FIFO_BUDGET, 1000000)
  212. #endif // USE_STRATEGY_LOW_MEMORY
  213. #define MAX_PACKET_SIZE 1600 // Maximum packet size
  214. #define UDP_BUF_SIZE (32 * 1024) // Aim of the UDP packet size
  215. #ifndef USE_STRATEGY_LOW_MEMORY
  216. #define MAX_SEND_SOCKET_QUEUE_SIZE VPN_GP(GP_MAX_SEND_SOCKET_QUEUE_SIZE, (1600 * 1600 * 1)) // Maximum transmit queue size
  217. #define MIN_SEND_SOCKET_QUEUE_SIZE VPN_GP(GP_MIN_SEND_SOCKET_QUEUE_SIZE, (1600 * 200 * 1)) // Minimum transmit queue size
  218. #define MAX_STORED_QUEUE_NUM VPN_GP(GP_MAX_STORED_QUEUE_NUM, 1024) // The number of queues that can be stored in each session
  219. #define MAX_BUFFERING_PACKET_SIZE VPN_GP(GP_MAX_BUFFERING_PACKET_SIZE, (1600 * 1600)) // Maximum packet size can be buffered
  220. #else // USE_STRATEGY_LOW_MEMORY
  221. #define MAX_SEND_SOCKET_QUEUE_SIZE VPN_GP(GP_MAX_SEND_SOCKET_QUEUE_SIZE, (1600 * 200 * 1)) // Maximum transmit queue size
  222. #define MIN_SEND_SOCKET_QUEUE_SIZE VPN_GP(GP_MIN_SEND_SOCKET_QUEUE_SIZE, (1600 * 50 * 1)) // Minimum transmit queue size
  223. #define MAX_STORED_QUEUE_NUM VPN_GP(GP_MAX_STORED_QUEUE_NUM, 384) // The number of queues that can be stored in each session
  224. #define MAX_BUFFERING_PACKET_SIZE VPN_GP(GP_MAX_BUFFERING_PACKET_SIZE, (1600 * 300 * 1)) // Maximum packet size can be buffered
  225. #endif // USE_STRATEGY_LOW_MEMORY
  226. #define MAX_SEND_SOCKET_QUEUE_NUM VPN_GP(GP_MAX_SEND_SOCKET_QUEUE_NUM, 128) // Maximum number of transmission queue items per processing
  227. #define MAX_TCP_CONNECTION 32 // The maximum number of TCP connections
  228. #define NUM_TCP_CONNECTION_FOR_UDP_RECOVERY 2 // Maximum number of connections when using UDP recovery
  229. #define SELECT_TIME VPN_GP(GP_SELECT_TIME, 256)
  230. #define SELECT_TIME_FOR_NAT VPN_GP(GP_SELECT_TIME_FOR_NAT, 30)
  231. #define SELECT_TIME_FOR_DELAYED_PKT 1 // If there is a delayed packet
  232. #define TIMEOUT_MIN (5 * 1000) // Minimum timeout in seconds
  233. #define TIMEOUT_MAX (60 * 1000) // Maximum timeout in seconds
  234. #define TIMEOUT_DEFAULT (30 * 1000) // Default number of seconds to timeout
  235. #define CONNECTING_TIMEOUT (15 * 1000) // Timeout in seconds of being connected
  236. #define CONNECTING_TIMEOUT_PROXY (4 * 1000) // Timeout in seconds of being connected (Proxy)
  237. #define CONNECTING_POOLING_SPAN (3 * 1000) // Polling interval of connected
  238. #define MIN_RETRY_INTERVAL (5 * 1000) // Minimum retry interval
  239. #define MAX_RETRY_INTERVAL (300 * 1000) // Maximum retry interval
  240. #define RETRY_INTERVAL_SPECIAL (60 * 1000) // Reconnection interval of a special case
  241. #define MAX_ADDITONAL_CONNECTION_FAILED_COUNTER 16 // Allowable number that can be serially failed to additional connection
  242. #define ADDITIONAL_CONNECTION_COUNTER_RESET_INTERVAL (30 * 60 * 1000) // Reset period of additional connection failure counter
  243. #define MAC_MIN_LIMIT_COUNT 3 // Minimum number of MAC addresses
  244. #define IP_MIN_LIMIT_COUNT 4 // Number of IPv4 addresses minimum
  245. #define IP_MIN_LIMIT_COUNT_V6 5 // Number of IPv6 addresses minimum
  246. #define IP_LIMIT_WHEN_NO_ROUTING_V6 15 // Maximum number of IPv6 addresses when NoRouting policy is enabled
  247. #define MAC_TABLE_EXCLUSIVE_TIME (13 * 1000) // Period that can occupy the MAC address
  248. #define IP_TABLE_EXCLUSIVE_TIME (13 * 1000) // Period that can occupy the IP address
  249. #define MAC_TABLE_EXPIRE_TIME VPN_GP(GP_MAC_TABLE_EXPIRE_TIME, (600 * 1000)) // MAC address table expiration time
  250. #define IP_TABLE_EXPIRE_TIME VPN_GP(GP_IP_TABLE_EXPIRE_TIME, (60 * 1000)) // IP address table expiration time
  251. #define IP_TABLE_EXPIRE_TIME_DHCP VPN_GP(GP_IP_TABLE_EXPIRE_TIME_DHCP, (5 * 60 * 1000)) // IP address table expiration time (In the case of DHCP)
  252. #define HUB_ARP_SEND_INTERVAL VPN_GP(GP_HUB_ARP_SEND_INTERVAL, (5 * 1000)) // ARP packet transmission interval (alive check)
  253. #define LIMITER_SAMPLING_SPAN 1000 // Sampling interval of the traffic limiting device
  254. #define STORM_CHECK_SPAN VPN_GP(GP_STORM_CHECK_SPAN, 500) // Broadcast storm check interval
  255. #define STORM_DISCARD_VALUE_START VPN_GP(GP_STORM_DISCARD_VALUE_START, 3) // Broadcast packet discard value start value
  256. #define STORM_DISCARD_VALUE_END VPN_GP(GP_STORM_DISCARD_VALUE_END, 1024) // Broadcast packet discard value end value
  257. #define KEEP_INTERVAL_MIN 5 // Packet transmission interval minimum value
  258. #define KEEP_INTERVAL_DEFAULT 50 // Packet transmission interval default value
  259. #define KEEP_INTERVAL_MAX 600 // Packet transmission interval maximum value
  260. #define KEEP_TCP_TIMEOUT 1000 // TCP time-out value
  261. #define TICKET_EXPIRES (60 * 1000) // Expiration date of ticket
  262. #define SEND_KILL_NUM_X 256 // Number of 'X' characters to send the Kill
  263. #define FARM_BASE_POINT 100000 // Reference value of the cluster score
  264. #define FARM_DEFAULT_WEIGHT 100 // Standard performance ratio
  265. #define SE_UDP_SIGN "SE2P" // Not used (only old UDP mode)
  266. // R-UDP service name
  267. #define VPN_RUDP_SVC_NAME "SoftEther_VPN"
  268. // Traffic information update interval
  269. #define INCREMENT_TRAFFIC_INTERVAL (10 * 1000)
  270. // State of the client session
  271. #define CLIENT_STATUS_CONNECTING 0 // Connecting
  272. #define CLIENT_STATUS_NEGOTIATION 1 // Negotiating
  273. #define CLIENT_STATUS_AUTH 2 // During user authentication
  274. #define CLIENT_STATUS_ESTABLISHED 3 // Connection complete
  275. #define CLIENT_STATUS_RETRY 4 // Wait to retry
  276. #define CLIENT_STATUS_IDLE 5 // Idle state
  277. // Expiration date of the black list
  278. #define BLACK_LIST_EXPIRES (30 * 10000)
  279. // Number Blacklist entries
  280. #define MAX_BLACK_LIST 4096
  281. #define BLACK_LIST_CHECK_SPAN 1000
  282. // Blocks to be transmitted at one during the file transfer
  283. #define FTP_BLOCK_SIZE (640 * 1024)
  284. // Syslog configuration
  285. #define SYSLOG_NONE 0 // Do not use syslog
  286. #define SYSLOG_SERVER_LOG 1 // Only server log
  287. #define SYSLOG_SERVER_AND_HUB_SECURITY_LOG 2 // Server and Virtual HUB security log
  288. #define SYSLOG_SERVER_AND_HUB_ALL_LOG 3 // Server, Virtual HUB security, and packet log
  289. #define SYSLOG_PORT 514 // Syslog port number
  290. #define SYSLOG_POLL_IP_INTERVAL (UINT64)(3600 * 1000) // Interval to examine the IP address
  291. #define SYSLOG_POLL_IP_INTERVAL_NG (UINT64)(60 * 1000) // Interval to examine the IP address (previous failure)
  292. //////////////////////////////////////////////////////////////////////
  293. //
  294. // Connection-related constant
  295. //
  296. //////////////////////////////////////////////////////////////////////
  297. // Internet connection maintenance function (KeepAlive)
  298. #define KEEP_RETRY_INTERVAL (60 * 1000) // Reconnection interval on connection failure
  299. #define KEEP_MIN_PACKET_SIZE 1 // Minimum packet size
  300. #define KEEP_MAX_PACKET_SIZE 128 // Maximum packet size
  301. #define KEEP_POLLING_INTERVAL 250 // KEEP polling interval
  302. // Constants
  303. #define RECV_BUF_SIZE 65536 // Buffer size to be received at a time
  304. // Type of proxy
  305. #define PROXY_DIRECT 0 // Direct TCP connection
  306. #define PROXY_HTTP 1 // Connection via HTTP proxy server
  307. #define PROXY_SOCKS 2 // Connection via SOCKS proxy server
  308. // Direction of data flow
  309. #define TCP_BOTH 0 // Bi-directional
  310. #define TCP_SERVER_TO_CLIENT 1 // Only server -> client direction
  311. #define TCP_CLIENT_TO_SERVER 2 // Only client -> server direction
  312. // Type of connection
  313. #define CONNECTION_TYPE_CLIENT 0 // Client
  314. #define CONNECTION_TYPE_INIT 1 // During initialization
  315. #define CONNECTION_TYPE_LOGIN 2 // Login connection
  316. #define CONNECTION_TYPE_ADDITIONAL 3 // Additional connection
  317. #define CONNECTION_TYPE_FARM_RPC 4 // RPC for server farm
  318. #define CONNECTION_TYPE_ADMIN_RPC 5 // RPC for Management
  319. #define CONNECTION_TYPE_ENUM_HUB 6 // HUB enumeration
  320. #define CONNECTION_TYPE_PASSWORD 7 // Password change
  321. #define CONNECTION_TYPE_SSTP 8 // SSTP
  322. #define CONNECTION_TYPE_OPENVPN 9 // OpenVPN
  323. // Protocol
  324. #define CONNECTION_TCP 0 // TCP protocol
  325. #define CONNECTION_UDP 1 // UDP protocol
  326. #define CONNECTION_HUB_LAYER3 6 // Layer-3 switch session
  327. #define CONNECTION_HUB_BRIDGE 7 // Bridge session
  328. #define CONNECTION_HUB_SECURE_NAT 8 // Secure NAT session
  329. #define CONNECTION_HUB_LINK_SERVER 9 // HUB link session
  330. // Status
  331. #define CONNECTION_STATUS_ACCEPTED 0 // The connection is accepted (client side)
  332. #define CONNECTION_STATUS_NEGOTIATION 1 // Negotiating
  333. #define CONNECTION_STATUS_USERAUTH 2 // During user authentication
  334. #define CONNECTION_STATUS_ESTABLISHED 3 // Connection has been established
  335. #define CONNECTION_STATUS_CONNECTING 0 // Connecting (client side)
  336. // Magic number of KeepAlive packet
  337. #define KEEP_ALIVE_MAGIC 0xffffffff
  338. #define MAX_KEEPALIVE_SIZE 512
  339. //////////////////////////////////////////////////////////////////////
  340. //
  341. // Virtual HUB-related constant
  342. //
  343. //////////////////////////////////////////////////////////////////////
  344. #define SE_HUB_MAC_ADDR_SIGN 0xAE // Sign virtual HUB MAC address
  345. // Traffic difference value
  346. #define TRAFFIC_DIFF_USER 0 // User
  347. #define TRAFFIC_DIFF_HUB 1 // Virtual HUB
  348. #define MAX_TRAFFIC_DIFF 30000 // Maximum number of items
  349. // Type of HUB
  350. #define HUB_TYPE_STANDALONE 0 // Stand-alone HUB
  351. #define HUB_TYPE_FARM_STATIC 1 // Static HUB
  352. #define HUB_TYPE_FARM_DYNAMIC 2 // Dynamic HUB
  353. // Related to delay, jitter, packet loss in the access list
  354. #define HUB_ACCESSLIST_DELAY_MAX 10000 // Maximum delay
  355. #define HUB_ACCESSLIST_JITTER_MAX 100 // Maximum jitter
  356. #define HUB_ACCESSLIST_LOSS_MAX 100 // Maximum packet loss
  357. // Message related
  358. #define HUB_MAXMSG_LEN 20000 // The maximum number of characters in a message
  359. //////////////////////////////////////////////////////////////////////
  360. //
  361. // Type of user authentication
  362. //
  363. //////////////////////////////////////////////////////////////////////
  364. // Constant in the server-side
  365. #define AUTHTYPE_ANONYMOUS 0 // Anonymous authentication
  366. #define AUTHTYPE_PASSWORD 1 // Password authentication
  367. #define AUTHTYPE_USERCERT 2 // User certificate authentication
  368. #define AUTHTYPE_ROOTCERT 3 // Root certificate which is issued by trusted Certificate Authority
  369. #define AUTHTYPE_RADIUS 4 // Radius authentication
  370. #define AUTHTYPE_NT 5 // Windows NT authentication
  371. #define AUTHTYPE_TICKET 99 // Ticket authentication
  372. // Constant of the client side
  373. #define CLIENT_AUTHTYPE_ANONYMOUS 0 // Anonymous authentication
  374. #define CLIENT_AUTHTYPE_PASSWORD 1 // Password authentication
  375. #define CLIENT_AUTHTYPE_PLAIN_PASSWORD 2 // Plain password authentication
  376. #define CLIENT_AUTHTYPE_CERT 3 // Certificate authentication
  377. #define CLIENT_AUTHTYPE_SECURE 4 // Secure device authentication
  378. //////////////////////////////////////////////////////////////////////
  379. //
  380. // TCP listener related constants
  381. //
  382. //////////////////////////////////////////////////////////////////////
  383. // Retries in case it fails to Listen
  384. #define LISTEN_RETRY_TIME (2 * 1000) // If fail to Listen normally
  385. #define LISTEN_RETRY_TIME_NOIPV6 (60 * 1000) // If IPv6 support is disabled
  386. #define DOS_TABLE_EXPIRES_FIRST 250 // Initial value of the expiration date of DOS attack list
  387. #define DOS_TABLE_EXPIRES_MAX 1000 // Maximum value of the expiration date of DOS attack list
  388. #define DOS_TABLE_REFRESH_INTERVAL (10 * 1000) // Interval to update the DOS attack list
  389. #define DOS_TABLE_MAX_LIMIT_PER_IP 16 // Accessible number per an IP
  390. #define DOS_TABLE_EXPIRES_TOTAL (3000 * 1000) // Time to force delete the entry
  391. // Protocol to be used for the listener
  392. #define LISTENER_TCP 0 // TCP/IP
  393. #define LISTENER_UDP 1 // UDP/IP (not being used)
  394. #define LISTENER_INPROC 2 // In-process communication
  395. #define LISTENER_RUDP 3 // R-UDP with NAT-T
  396. #define LISTENER_ICMP 4 // VPN over ICMP
  397. #define LISTENER_DNS 5 // VPN over DNS
  398. #define LISTENER_REVERSE 6 // Reverse socket
  399. // Status of the listener
  400. #define LISTENER_STATUS_TRYING 0 // While attempting
  401. #define LISTENER_STATUS_LISTENING 1 // Listening
  402. // Largest packet size of UDP
  403. #define UDP_PACKET_SIZE 65536
  404. // Number of standard connections per IP address
  405. #define DEFAULT_MAX_CONNECTIONS_PER_IP 256
  406. #define MIN_MAX_CONNECTIONS_PER_IP 10 // Minimum value
  407. // Allowed number of outstanding connections
  408. #define DEFAULT_MAX_UNESTABLISHED_CONNECTIONS 1000
  409. #define MIN_MAX_UNESTABLISHED_CONNECTIONS 30 // Minimum value
  410. //////////////////////////////////////////////////////////////////////
  411. //
  412. // Log related constant
  413. //
  414. //////////////////////////////////////////////////////////////////////
  415. #define LOG_ENGINE_SAVE_START_CACHE_COUNT 100000 // Number to start saving forcibly
  416. #define LOG_ENGINE_BUFFER_CACHE_SIZE_MAX (10 * 1024 * 1024) // Write cache size
  417. // Constant such as a file name
  418. #define SERVER_LOG_DIR_NAME "@server_log"
  419. #define BRIDGE_LOG_DIR_NAME SERVER_LOG_DIR_NAME
  420. #define SERVER_LOG_PERFIX "vpn"
  421. #define HUB_SECURITY_LOG_DIR_NAME "@security_log"
  422. #define HUB_SECURITY_LOG_FILE_NAME "@security_log/%s"
  423. #define HUB_SECURITY_LOG_PREFIX "sec"
  424. #define HUB_PACKET_LOG_DIR_NAME "@packet_log"
  425. #define HUB_PACKET_LOG_FILE_NAME "@packet_log/%s"
  426. #define HUB_PACKET_LOG_PREFIX "pkt"
  427. #define NAT_LOG_DIR_NAME "@secure_nat_log"
  428. #define NAT_LOG_FILE_NAME "@secure_nat_log/%s"
  429. #define NAT_LOG_PREFIX "snat"
  430. #define CLIENT_LOG_DIR_NAME "@client_log"
  431. #define CLIENT_LOG_PREFIX "client"
  432. // Packet log settings
  433. #define NUM_PACKET_LOG 16
  434. #define PACKET_LOG_TCP_CONN 0 // TCP connection log
  435. #define PACKET_LOG_TCP 1 // TCP packet log
  436. #define PACKET_LOG_DHCP 2 // DHCP Log
  437. #define PACKET_LOG_UDP 3 // UDP log
  438. #define PACKET_LOG_ICMP 4 // ICMP log
  439. #define PACKET_LOG_IP 5 // IP log
  440. #define PACKET_LOG_ARP 6 // ARP log
  441. #define PACKET_LOG_ETHERNET 7 // Ethernet log
  442. #define PACKET_LOG_NONE 0 // Not save
  443. #define PACKET_LOG_HEADER 1 // Only header
  444. #define PACKET_LOG_ALL 2 // Store also data
  445. // Timing of log switching
  446. #define LOG_SWITCH_NO 0 // No switching
  447. #define LOG_SWITCH_SECOND 1 // Secondly basis
  448. #define LOG_SWITCH_MINUTE 2 // Minutely basis
  449. #define LOG_SWITCH_HOUR 3 // Hourly basis
  450. #define LOG_SWITCH_DAY 4 // Daily basis
  451. #define LOG_SWITCH_MONTH 5 // Monthly basis
  452. // Minimum amount of free disk space
  453. #define DISK_FREE_SPACE_MIN 1048576 // 1 MBytes
  454. #define DISK_FREE_SPACE_DEFAULT (DISK_FREE_SPACE_MIN * 100) // 100 Mbytes
  455. #define DISK_FREE_SPACE_DEFAULT_WINDOWS ((UINT64)(8ULL * 1024ULL * 1024ULL * 1024ULL)) // 8GBytes
  456. // Interval to check the free space
  457. #define DISK_FREE_CHECK_INTERVAL_DEFAULT (5 * 60 * 1000)
  458. // Simple log
  459. #define TINY_LOG_DIRNAME "@tiny_log"
  460. #define TINY_LOG_FILENAME "@tiny_log/%04u%02u%02u_%02u%02u%02u.log"
  461. //////////////////////////////////////////////////////////////////////
  462. //
  463. // Constant related to Carrier Edition
  464. //
  465. //////////////////////////////////////////////////////////////////////
  466. #define CE_SNAPSHOT_INTERVAL ((UINT64)(3600 * 1000))
  467. //#define CE_SNAPSHOT_INTERVAL ((UINT64)(3000))
  468. #define CE_SNAPSHOT_POLLING_INTERVAL (1 * 1000)
  469. #define CE_SNAPSHOT_POLLING_INTERVAL_LICENSE (30 * 1000)
  470. #define CE_SNAPSHOT_DIR_NAME "@carrier_log"
  471. #define CE_SNAPSHOT_PREFIX "carrier"
  472. //////////////////////////////////////////////////////////////////////
  473. //
  474. // Communication protocol related constant
  475. //
  476. //////////////////////////////////////////////////////////////////////
  477. // Administrator Username
  478. #define ADMINISTRATOR_USERNAME "administrator"
  479. // Maximum value of random size
  480. #define RAND_SIZE_MAX 4096
  481. // Expiration date of random size cache
  482. #define RAND_SIZE_CACHE_EXPIRE (24 * 60 * 60 * 1000)
  483. // Management allowed IP address list file name
  484. #define ADMINIP_TXT "@adminip.txt"
  485. #define NON_SSL_MIN_COUNT 60
  486. #define NON_SSL_ENTRY_EXPIRES (10 * 60 * 1000)
  487. //////////////////////////////////////////////////////////////////////
  488. //
  489. // The cascade related constants
  490. //
  491. //////////////////////////////////////////////////////////////////////
  492. #define LINK_DEVICE_NAME "_SEHUBLINKCLI_"
  493. #define LINK_USER_NAME "link"
  494. #define LINK_USER_NAME_PRINT "Cascade"
  495. //////////////////////////////////////////////////////////////////////
  496. //
  497. // Constant related to SecureNAT connection
  498. //
  499. //////////////////////////////////////////////////////////////////////
  500. #define SNAT_DEVICE_NAME "_SEHUBSECURENAT_"
  501. #define SNAT_USER_NAME "securenat"
  502. #define SNAT_USER_NAME_PRINT "SecureNAT"
  503. //////////////////////////////////////////////////////////////////////
  504. //
  505. // Constant related to bridge connection
  506. //
  507. //////////////////////////////////////////////////////////////////////
  508. #define BRIDGE_DEVICE_NAME "_SEHUBBRIDGE_"
  509. #define BRIDGE_USER_NAME "localbridge"
  510. #define BRIDGE_USER_NAME_PRINT "Local Bridge"
  511. #define BRIDGE_TRY_SPAN 1000
  512. #define BRIDGE_NUM_DEVICE_CHECK_SPAN (5 * 60 * 1000)
  513. #define BRIDGE_NETWORK_CONNECTION_STR L"%s [%S]"
  514. //////////////////////////////////////////////////////////////////////
  515. //
  516. // EtherLogger related constants
  517. //
  518. //////////////////////////////////////////////////////////////////////
  519. #define EL_ADMIN_PORT 22888
  520. #define EL_CONFIG_FILENAME "@etherlogger.config"
  521. #define EL_PACKET_LOG_DIR_NAME "@etherlogger_log"
  522. #define EL_PACKET_LOG_FILE_NAME "@etherlogger_log/%s"
  523. #define EL_PACKET_LOG_PREFIX "pkt"
  524. #define EL_LICENSE_CHECK_SPAN (10 * 1000)
  525. //////////////////////////////////////////////////////////////////////
  526. //
  527. // Layer-3 Switch related constants
  528. //
  529. //////////////////////////////////////////////////////////////////////
  530. #define MAX_NUM_L3_SWITCH 4096
  531. #define MAX_NUM_L3_IF 4096
  532. #define MAX_NUM_L3_TABLE 4096
  533. //////////////////////////////////////////////////////////////////////
  534. //
  535. // Constant related to User-mode Router
  536. //
  537. //////////////////////////////////////////////////////////////////////
  538. #define ARP_ENTRY_EXPIRES (30 * 1000) // ARP table expiration date
  539. #define ARP_ENTRY_POLLING_TIME (1 * 1000) // ARP table cleaning timer
  540. #define ARP_REQUEST_TIMEOUT (1000) // ARP request time-out period
  541. #define ARP_REQUEST_GIVEUP (5 * 1000) // Time to give up sending the ARP request
  542. #define IP_WAIT_FOR_ARP_TIMEOUT (5 * 1000) // Total time that an IP packet waiting for ARP table
  543. #define IP_COMBINE_TIMEOUT (10 * 1000) // Time-out of IP packet combining
  544. #define NAT_TCP_MAX_TIMEOUT (2000000 * 1000) // Maximum TCP session timeout in seconds
  545. #define NAT_UDP_MAX_TIMEOUT (2000000 * 1000) // Maximum UDP session timeout in seconds
  546. #define NAT_TCP_MIN_TIMEOUT (1 * 60 * 1000) // Minimum TCP session timeout in seconds
  547. #define NAT_UDP_MIN_TIMEOUT (10 * 1000) // Minimum UDP session timeout in seconds
  548. #define NAT_TCP_RECV_WINDOW_SIZE 64512 // TCP receive window size
  549. #define NAT_TCP_SYNACK_SEND_TIMEOUT 250 // Sending TCP SYN+ACK interval
  550. #define NAT_ICMP_TIMEOUT (10 * 1000) // ICMP timeout in seconds
  551. #define NAT_ICMP_TIMEOUT_WITH_API (3 * 1000) // Timeout in seconds in the case of using the ICMP API
  552. #define NAT_SEND_BUF_SIZE (64 * 1024) // TCP send buffer size
  553. #define NAT_RECV_BUF_SIZE (64 * 1024) // TCP receive buffer size
  554. #define NAT_TMPBUF_SIZE (128 * 1024) // TCP temporally memory area size
  555. #define NAT_ACK_KEEPALIVE_SPAN (5 * 1000) // ACK transmission interval for TCP keep alive
  556. #define NAT_INITIAL_RTT_VALUE 500 // Initial RTT value
  557. #define NAT_FIN_SEND_INTERVAL 1000 // FIN transmission interval
  558. #define NAT_FIN_SEND_MAX_COUNT 5 // Total number of FIN transmissions
  559. #define NAT_DNS_PROXY_PORT 53 // DNS proxy port number
  560. #define NAT_DNS_RESPONSE_TTL (20 * 60) // TTL of the DNS response
  561. #define NAT_DHCP_SERVER_PORT 67 // DHCP server port number
  562. #define NAT_DHCP_CLIENT_PORT 68 // DHCP client port number
  563. #define DHCP_MIN_EXPIRE_TIMESPAN (15 * 1000) // DHCP minimum expiration date
  564. #define DHCP_POLLING_INTERVAL 1000 // DHCP polling interval
  565. #define X32 ((UINT64)4294967296ULL) // 32bit + 1
  566. #define NAT_DNS_QUERY_TIMEOUT (512) // Time-out value of DNS queries
  567. // Beacon transmission interval
  568. #define BEACON_SEND_INTERVAL (5 * 1000)
  569. // Total size quota allowed in the queue for the combining the IP packet
  570. #define IP_COMBINE_WAIT_QUEUE_SIZE_QUOTA (50 * 1024 * 1024)
  571. // Header size constant
  572. #define MAC_HEADER_SIZE (sizeof(MAC_HEADER))
  573. #define ARP_HEADER_SIZE (sizeof(ARP_HEADER))
  574. #define IP_HEADER_SIZE (sizeof(IPV4_HEADER))
  575. #define TCP_HEADER_SIZE (sizeof(TCP_HEADER))
  576. #define UDP_HEADER_SIZE (sizeof(UDP_HEADER))
  577. // Data maximum size constant
  578. #define MAX_L3_DATA_SIZE (1500)
  579. #define MAX_IP_DATA_SIZE (MAX_L3_DATA_SIZE - IP_HEADER_SIZE)
  580. #define MAX_TCP_DATA_SIZE (MAX_IP_DATA_SIZE - TCP_HEADER_SIZE)
  581. #define MAX_UDP_DATA_SIZE (MAX_IP_DATA_SIZE - UDP_HEADER_SIZE)
  582. #define MAX_IP_DATA_SIZE_TOTAL (65535)
  583. // IP packet option constant
  584. #define DEFAULT_IP_TOS 0 // TOS in the IP header
  585. #define DEFAULT_IP_TTL 128 // TTL in the IP header
  586. // Type of NAT session
  587. #define NAT_TCP 0 // TCP NAT
  588. #define NAT_UDP 1 // UDP NAT
  589. #define NAT_DNS 2 // DNS NAT
  590. #define NAT_ICMP 3 // ICMP NAT
  591. // State of NAT session
  592. #define NAT_TCP_CONNECTING 0 // Connecting
  593. #define NAT_TCP_SEND_RESET 1 // Send the RST (Connection failure or disconnected)
  594. #define NAT_TCP_CONNECTED 2 // Connection complete
  595. #define NAT_TCP_ESTABLISHED 3 // Connection established
  596. #define NAT_TCP_WAIT_DISCONNECT 4 // Wait for socket disconnection
  597. //////////////////////////////////////////////////////////////////////
  598. //
  599. // For UNIX virtual LAN card related constant
  600. //
  601. //////////////////////////////////////////////////////////////////////
  602. #define TAP_FILENAME_1 "/dev/net/tun"
  603. #define TAP_FILENAME_2 "/dev/tun"
  604. #ifdef UNIX_MACOS
  605. #ifdef NO_VLAN
  606. #define TAP_MACOS_FILENAME "/dev/tap0"
  607. #else // NO_VLAN
  608. #define TAP_MACOS_FILENAME "tap"
  609. #endif // NO_VLAN
  610. #define TAP_MACOS_DIR "/dev/"
  611. #define TAP_MACOS_NUMBER (16)
  612. #endif // UNIX_MACOS
  613. #define LICENSE_EDITION_VPN3_NO_LICENSE 0 // Without license
  614. #define LICENSE_MAX_PRODUCT_NAME_LEN 255 // Maximum length of license product name
  615. #define LICENSE_NUM_SHA 10000 // Number of times to hash with SHA
  616. #define LICENSE_SYSTEM_KEY_NUM 2048 // Key number for system
  617. #define LICENSE_SYSTEM_KEYSIZE_BIT 144 // Number of key bits for system
  618. #define LICENSE_PRODUCT_KEY_NUM 16384 // Number of keys for product
  619. #define LICENSE_PRODUCT_KEYSIZE_BIT 56 // Number of key bits for product
  620. #define LICENSE_PRODUCT_COMMON_KEYSIZE_BIT 48 // Number of common key bits for product
  621. #define LICENSE_MASTER_KEYSIZE_BIT 1024 // Number of master key bits
  622. #define LICENSE_SYSTEM_ID_MIN 0ULL // System ID minimum value
  623. #define LICENSE_SYSTEM_ID_MAX 549755813887ULL // System ID maximum value
  624. #define LICENSE_SERIAL_ID_MIN 0 // Serial ID minimum value
  625. #define LICENSE_SERIAL_ID_MAX 65535 // Serial ID maximum value
  626. #define LICENSE_EXPIRES_MIN 0 // Expiration date minimum
  627. #define LICENSE_EXPIRES_MAX 16383 // Expiration date maximum
  628. #define LICENSE_KEYSTR_LEN 41 // Length of the license key
  629. #define LICENSE_LICENSEID_STR_LEN 33 // Length of the license ID
  630. #define LICENSE_STATUS_OK 0 // Enabled
  631. #define LICENSE_STATUS_EXPIRED 1 // Invalid (expired)
  632. #define LICENSE_STATUS_ID_DIFF 2 // Invalid (System ID mismatch)
  633. #define LICENSE_STATUS_DUP 3 // Invalid (duplicated)
  634. #define LICENSE_STATUS_INSUFFICIENT 4 // Invalid (other necessary license shortage)
  635. #define LICENSE_STATUS_COMPETITION 5 // Invalid (conflict with other licenses)
  636. #define LICENSE_STATUS_NONSENSE 6 // Invalid (meaningless in the current edition)
  637. #define LICENSE_STATUS_CPU 7 // Invalid (CPU type mismatch)
  638. #define BIT_TO_BYTE(x) (((x) + 7) / 8)
  639. #define BYTE_TO_BIT(x) ((x) * 8)
  640. //////////////////////////////////////////////////////////////////////
  641. //
  642. // Error code
  643. //
  644. //////////////////////////////////////////////////////////////////////
  645. #define ERR_NO_ERROR 0 // No error
  646. #define ERR_CONNECT_FAILED 1 // Connection to the server has failed
  647. #define ERR_SERVER_IS_NOT_VPN 2 // The destination server is not a VPN server
  648. #define ERR_DISCONNECTED 3 // The connection has been interrupted
  649. #define ERR_PROTOCOL_ERROR 4 // Protocol error
  650. #define ERR_CLIENT_IS_NOT_VPN 5 // Connecting client is not a VPN client
  651. #define ERR_USER_CANCEL 6 // User cancel
  652. #define ERR_AUTHTYPE_NOT_SUPPORTED 7 // Specified authentication method is not supported
  653. #define ERR_HUB_NOT_FOUND 8 // The HUB does not exist
  654. #define ERR_AUTH_FAILED 9 // Authentication failure
  655. #define ERR_HUB_STOPPING 10 // HUB is stopped
  656. #define ERR_SESSION_REMOVED 11 // Session has been deleted
  657. #define ERR_ACCESS_DENIED 12 // Access denied
  658. #define ERR_SESSION_TIMEOUT 13 // Session times out
  659. #define ERR_INVALID_PROTOCOL 14 // Protocol is invalid
  660. #define ERR_TOO_MANY_CONNECTION 15 // Too many connections
  661. #define ERR_HUB_IS_BUSY 16 // Too many sessions of the HUB
  662. #define ERR_PROXY_CONNECT_FAILED 17 // Connection to the proxy server fails
  663. #define ERR_PROXY_ERROR 18 // Proxy Error
  664. #define ERR_PROXY_AUTH_FAILED 19 // Failed to authenticate on the proxy server
  665. #define ERR_TOO_MANY_USER_SESSION 20 // Too many sessions of the same user
  666. #define ERR_LICENSE_ERROR 21 // License error
  667. #define ERR_DEVICE_DRIVER_ERROR 22 // Device driver error
  668. #define ERR_INTERNAL_ERROR 23 // Internal error
  669. #define ERR_SECURE_DEVICE_OPEN_FAILED 24 // The secure device cannot be opened
  670. #define ERR_SECURE_PIN_LOGIN_FAILED 25 // PIN code is incorrect
  671. #define ERR_SECURE_NO_CERT 26 // Specified certificate is not stored
  672. #define ERR_SECURE_NO_PRIVATE_KEY 27 // Specified private key is not stored
  673. #define ERR_SECURE_CANT_WRITE 28 // Write failure
  674. #define ERR_OBJECT_NOT_FOUND 29 // Specified object can not be found
  675. #define ERR_VLAN_ALREADY_EXISTS 30 // Virtual LAN card with the specified name already exists
  676. #define ERR_VLAN_INSTALL_ERROR 31 // Specified virtual LAN card cannot be created
  677. #define ERR_VLAN_INVALID_NAME 32 // Specified name of the virtual LAN card is invalid
  678. #define ERR_NOT_SUPPORTED 33 // Unsupported
  679. #define ERR_ACCOUNT_ALREADY_EXISTS 34 // Account already exists
  680. #define ERR_ACCOUNT_ACTIVE 35 // Account is operating
  681. #define ERR_ACCOUNT_NOT_FOUND 36 // Specified account doesn't exist
  682. #define ERR_ACCOUNT_INACTIVE 37 // Account is offline
  683. #define ERR_INVALID_PARAMETER 38 // Parameter is invalid
  684. #define ERR_SECURE_DEVICE_ERROR 39 // Error has occurred in the operation of the secure device
  685. #define ERR_NO_SECURE_DEVICE_SPECIFIED 40 // Secure device is not specified
  686. #define ERR_VLAN_IS_USED 41 // Virtual LAN card in use by account
  687. #define ERR_VLAN_FOR_ACCOUNT_NOT_FOUND 42 // Virtual LAN card of the account can not be found
  688. #define ERR_VLAN_FOR_ACCOUNT_USED 43 // Virtual LAN card of the account is already in use
  689. #define ERR_VLAN_FOR_ACCOUNT_DISABLED 44 // Virtual LAN card of the account is disabled
  690. #define ERR_INVALID_VALUE 45 // Value is invalid
  691. #define ERR_NOT_FARM_CONTROLLER 46 // Not a farm controller
  692. #define ERR_TRYING_TO_CONNECT 47 // Attempting to connect
  693. #define ERR_CONNECT_TO_FARM_CONTROLLER 48 // Failed to connect to the farm controller
  694. #define ERR_COULD_NOT_HOST_HUB_ON_FARM 49 // A virtual HUB on farm could not be created
  695. #define ERR_FARM_MEMBER_HUB_ADMIN 50 // HUB cannot be managed on a farm member
  696. #define ERR_NULL_PASSWORD_LOCAL_ONLY 51 // Accepting only local connections for an empty password
  697. #define ERR_NOT_ENOUGH_RIGHT 52 // Right is insufficient
  698. #define ERR_LISTENER_NOT_FOUND 53 // Listener can not be found
  699. #define ERR_LISTENER_ALREADY_EXISTS 54 // Listener already exists
  700. #define ERR_NOT_FARM_MEMBER 55 // Not a farm member
  701. #define ERR_CIPHER_NOT_SUPPORTED 56 // Encryption algorithm is not supported
  702. #define ERR_HUB_ALREADY_EXISTS 57 // HUB already exists
  703. #define ERR_TOO_MANY_HUBS 58 // Too many HUBs
  704. #define ERR_LINK_ALREADY_EXISTS 59 // Link already exists
  705. #define ERR_LINK_CANT_CREATE_ON_FARM 60 // The link can not be created on the server farm
  706. #define ERR_LINK_IS_OFFLINE 61 // Link is off-line
  707. #define ERR_TOO_MANY_ACCESS_LIST 62 // Too many access list
  708. #define ERR_TOO_MANY_USER 63 // Too many users
  709. #define ERR_TOO_MANY_GROUP 64 // Too many Groups
  710. #define ERR_GROUP_NOT_FOUND 65 // Group can not be found
  711. #define ERR_USER_ALREADY_EXISTS 66 // User already exists
  712. #define ERR_GROUP_ALREADY_EXISTS 67 // Group already exists
  713. #define ERR_USER_AUTHTYPE_NOT_PASSWORD 68 // Authentication method of the user is not a password authentication
  714. #define ERR_OLD_PASSWORD_WRONG 69 // The user does not exist or the old password is wrong
  715. #define ERR_LINK_CANT_DISCONNECT 73 // Cascade session cannot be disconnected
  716. #define ERR_ACCOUNT_NOT_PRESENT 74 // Not completed configure the connection to the VPN server
  717. #define ERR_ALREADY_ONLINE 75 // It is already online
  718. #define ERR_OFFLINE 76 // It is offline
  719. #define ERR_NOT_RSA_1024 77 // The certificate is not RSA 1024bit
  720. #define ERR_SNAT_CANT_DISCONNECT 78 // SecureNAT session cannot be disconnected
  721. #define ERR_SNAT_NEED_STANDALONE 79 // SecureNAT works only in stand-alone HUB
  722. #define ERR_SNAT_NOT_RUNNING 80 // SecureNAT function is not working
  723. #define ERR_SE_VPN_BLOCK 81 // Stopped by PacketiX VPN Block
  724. #define ERR_BRIDGE_CANT_DISCONNECT 82 // Bridge session can not be disconnected
  725. #define ERR_LOCAL_BRIDGE_STOPPING 83 // Bridge function is stopped
  726. #define ERR_LOCAL_BRIDGE_UNSUPPORTED 84 // Bridge feature is not supported
  727. #define ERR_CERT_NOT_TRUSTED 85 // Certificate of the destination server can not be trusted
  728. #define ERR_PRODUCT_CODE_INVALID 86 // Product code is different
  729. #define ERR_VERSION_INVALID 87 // Version is different
  730. #define ERR_CAPTURE_DEVICE_ADD_ERROR 88 // Adding capture device failure
  731. #define ERR_VPN_CODE_INVALID 89 // VPN code is different
  732. #define ERR_CAPTURE_NOT_FOUND 90 // Capture device can not be found
  733. #define ERR_LAYER3_CANT_DISCONNECT 91 // Layer-3 session cannot be disconnected
  734. #define ERR_LAYER3_SW_EXISTS 92 // L3 switch of the same already exists
  735. #define ERR_LAYER3_SW_NOT_FOUND 93 // Layer-3 switch can not be found
  736. #define ERR_INVALID_NAME 94 // Name is invalid
  737. #define ERR_LAYER3_IF_ADD_FAILED 95 // Failed to add interface
  738. #define ERR_LAYER3_IF_DEL_FAILED 96 // Failed to delete the interface
  739. #define ERR_LAYER3_IF_EXISTS 97 // Interface that you specified already exists
  740. #define ERR_LAYER3_TABLE_ADD_FAILED 98 // Failed to add routing table
  741. #define ERR_LAYER3_TABLE_DEL_FAILED 99 // Failed to delete the routing table
  742. #define ERR_LAYER3_TABLE_EXISTS 100 // Routing table entry that you specified already exists
  743. #define ERR_BAD_CLOCK 101 // Time is queer
  744. #define ERR_LAYER3_CANT_START_SWITCH 102 // The Virtual Layer 3 Switch can not be started
  745. #define ERR_CLIENT_LICENSE_NOT_ENOUGH 103 // Client connection licenses shortage
  746. #define ERR_BRIDGE_LICENSE_NOT_ENOUGH 104 // Bridge connection licenses shortage
  747. #define ERR_SERVER_CANT_ACCEPT 105 // Not Accept on the technical issues
  748. #define ERR_SERVER_CERT_EXPIRES 106 // Destination VPN server has expired
  749. #define ERR_MONITOR_MODE_DENIED 107 // Monitor port mode was rejected
  750. #define ERR_BRIDGE_MODE_DENIED 108 // Bridge-mode or Routing-mode was rejected
  751. #define ERR_IP_ADDRESS_DENIED 109 // Client IP address is denied
  752. #define ERR_TOO_MANT_ITEMS 110 // Too many items
  753. #define ERR_MEMORY_NOT_ENOUGH 111 // Out of memory
  754. #define ERR_OBJECT_EXISTS 112 // Object already exists
  755. #define ERR_FATAL 113 // A fatal error occurred
  756. #define ERR_SERVER_LICENSE_FAILED 114 // License violation has occurred on the server side
  757. #define ERR_SERVER_INTERNET_FAILED 115 // Server side is not connected to the Internet
  758. #define ERR_CLIENT_LICENSE_FAILED 116 // License violation occurs on the client side
  759. #define ERR_BAD_COMMAND_OR_PARAM 117 // Command or parameter is invalid
  760. #define ERR_INVALID_LICENSE_KEY 118 // License key is invalid
  761. #define ERR_NO_VPN_SERVER_LICENSE 119 // There is no valid license for the VPN Server
  762. #define ERR_NO_VPN_CLUSTER_LICENSE 120 // There is no cluster license
  763. #define ERR_NOT_ADMINPACK_SERVER 121 // Not trying to connect to a server with the Administrator Pack license
  764. #define ERR_NOT_ADMINPACK_SERVER_NET 122 // Not trying to connect to a server with the Administrator Pack license (for .NET)
  765. #define ERR_BETA_EXPIRES 123 // Destination Beta VPN Server has expired
  766. #define ERR_BRANDED_C_TO_S 124 // Branding string of connection limit is different (Authentication on the server side)
  767. #define ERR_BRANDED_C_FROM_S 125 // Branding string of connection limit is different (Authentication for client-side)
  768. #define ERR_AUTO_DISCONNECTED 126 // VPN session is disconnected for a certain period of time has elapsed
  769. #define ERR_CLIENT_ID_REQUIRED 127 // Client ID does not match
  770. #define ERR_TOO_MANY_USERS_CREATED 128 // Too many created users
  771. #define ERR_SUBSCRIPTION_IS_OLDER 129 // Subscription expiration date Is earlier than the build date of the VPN Server
  772. #define ERR_ILLEGAL_TRIAL_VERSION 130 // Many trial license is used continuously
  773. #define ERR_NAT_T_TWO_OR_MORE 131 // There are multiple servers in the back of a global IP address in the NAT-T connection
  774. #define ERR_DUPLICATE_DDNS_KEY 132 // DDNS host key duplicate
  775. #define ERR_DDNS_HOSTNAME_EXISTS 133 // Specified DDNS host name already exists
  776. #define ERR_DDNS_HOSTNAME_INVALID_CHAR 134 // Characters that can not be used for the host name is included
  777. #define ERR_DDNS_HOSTNAME_TOO_LONG 135 // Host name is too long
  778. #define ERR_DDNS_HOSTNAME_IS_EMPTY 136 // Host name is not specified
  779. #define ERR_DDNS_HOSTNAME_TOO_SHORT 137 // Host name is too short
  780. #define ERR_MSCHAP2_PASSWORD_NEED_RESET 138 // Necessary that password is changed
  781. #define ERR_DDNS_DISCONNECTED 139 // Communication to the dynamic DNS server is disconnected
  782. #define ERR_SPECIAL_LISTENER_ICMP_ERROR 140 // The ICMP socket can not be opened
  783. #define ERR_SPECIAL_LISTENER_DNS_ERROR 141 // Socket for DNS port can not be opened
  784. #define ERR_OPENVPN_IS_NOT_ENABLED 142 // OpenVPN server feature is not enabled
  785. #define ERR_NOT_SUPPORTED_AUTH_ON_OPENSOURCE 143 // It is the type of user authentication that are not supported in the open source version
  786. #define ERR_VPNGATE 144 // Operation on VPN Gate Server is not available
  787. #define ERR_VPNGATE_CLIENT 145 // Operation on VPN Gate Client is not available
  788. #define ERR_VPNGATE_INCLIENT_CANT_STOP 146 // Can not be stopped if operating within VPN Client mode
  789. #define ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE 147 // It is a feature that is not supported in the open source version
  790. #define ERR_SUSPENDING 148 // System is suspending
  791. ////////////////////////////
  792. // Generally used structure
  793. // Network Services
  794. typedef struct NETSVC
  795. {
  796. bool Udp; // false=TCP, true=UDP
  797. UINT Port; // Port number
  798. char *Name; // Name
  799. } NETSVC;
  800. // Traffic data entry
  801. typedef struct TRAFFIC_ENTRY
  802. {
  803. UINT64 BroadcastCount; // Number of broadcast packets
  804. UINT64 BroadcastBytes; // Broadcast bytes
  805. UINT64 UnicastCount; // Unicast count
  806. UINT64 UnicastBytes; // Unicast bytes
  807. } TRAFFIC_ENTRY;
  808. // Traffic data
  809. typedef struct TRAFFIC
  810. {
  811. TRAFFIC_ENTRY Send; // Transmitted data
  812. TRAFFIC_ENTRY Recv; // Received data
  813. } TRAFFIC;
  814. // Non-SSL connection source
  815. typedef struct NON_SSL
  816. {
  817. IP IpAddress; // IP address
  818. UINT64 EntryExpires; // Expiration date of entry
  819. UINT Count; // Number of connection count
  820. } NON_SSL;
  821. // Simple log storage
  822. typedef struct TINY_LOG
  823. {
  824. char FileName[MAX_PATH]; // File name
  825. IO *io; // File
  826. LOCK *Lock; // Lock
  827. } TINY_LOG;
  828. // CEDAR structure
  829. typedef struct CEDAR
  830. {
  831. LOCK *lock; // Lock
  832. REF *ref; // Reference counter
  833. COUNTER *AcceptingSockets; // Number of sockets in Accept
  834. UINT Type; // Type
  835. LIST *ListenerList; // Listener list
  836. LIST *HubList; // HUB list
  837. LIST *ConnectionList; // Negotiating connection list
  838. LIST *CaList; // List of CA
  839. volatile bool Halt; // Halt flag
  840. COUNTER *ConnectionIncrement; // Connection increment counter
  841. X *ServerX; // Server certificate
  842. K *ServerK; // Private key of the server certificate
  843. char *CipherList; // List of encryption algorithms
  844. UINT Version; // Version information
  845. UINT Build; // Build Number
  846. char *ServerStr; // Server string
  847. char *MachineName; // Computer name
  848. char *HttpUserAgent; // HTTP user agent
  849. char *HttpAccept; // HTTP Accept
  850. char *HttpAcceptLanguage; // HTTP Accept Language
  851. char *HttpAcceptEncoding; // HTTP Accept Encoding
  852. TRAFFIC *Traffic; // Traffic information
  853. LOCK *TrafficLock; // Traffic information lock
  854. LIST *UDPEntryList; // UDP entry list
  855. COUNTER *CurrentSessions; // The current number of sessions
  856. COUNTER *CurrentTcpConnections; // Number of current TCP connections
  857. LIST *NetSvcList; // Network service list
  858. char *VerString; // Version string
  859. char *BuildInfo; // Build Information
  860. struct CLIENT *Client; // Client
  861. struct SERVER *Server; // Server
  862. UINT64 CreatedTick; // Generation date and time
  863. bool CheckExpires; // Check the expiration date
  864. LIST *TrafficDiffList; // Traffic difference list
  865. struct LOG *DebugLog; // Debug log
  866. UCHAR UniqueId[16]; // Unique ID
  867. LIST *LocalBridgeList; // Local bridge list
  868. bool Bridge; // Bridge version
  869. LIST *L3SwList; // Layer-3 switch list
  870. COUNTER *AssignedClientLicense; // Number of assigned client licenses
  871. COUNTER *AssignedBridgeLicense; // Number of assigned bridge licenses
  872. UINT64 LicenseViolationTick; // License violation occurs
  873. LIST *NonSslList; // Non-SSL connection list
  874. struct WEBUI *WebUI; // Data for WebUI service
  875. UINT Beta; // Beta number
  876. LOCK *CedarSuperLock; // Cedar super lock!
  877. bool DisableIPv6Listener; // Disable IPv6 listener
  878. UINT ClientId; // Client ID
  879. UINT64 BuiltDate; // Build Date
  880. LIST *UdpPortList; // UDP port list in use
  881. char CurrentDDnsFqdn[MAX_SIZE]; // FQDN of the current DDNS
  882. char OpenVPNPublicPorts[MAX_SIZE]; // OpenVPN public UDP port list
  883. LOCK *OpenVPNPublicPortsLock; // Lock of OpenVPN public UDP port list
  884. LOCK *CurrentRegionLock; // Current region lock
  885. char CurrentRegion[128]; // Current region
  886. LOCK *CurrentTcpQueueSizeLock; // Current TCP send queue size lock
  887. UINT CurrentTcpQueueSize; // Current TCP send queue size
  888. COUNTER *CurrentActiveLinks; // Current active cascade connections
  889. LOCK *QueueBudgetLock; // Queue budget lock
  890. UINT QueueBudget; // Queue budget
  891. LOCK *FifoBudgetLock; // Fifo budget lock
  892. UINT FifoBudget; // Fifo budget
  893. SSL_ACCEPT_SETTINGS SslAcceptSettings; // SSL Accept Settings
  894. char OpenVPNDefaultClientOption[MAX_SIZE]; // OpenVPN Default Client Option String
  895. } CEDAR;
  896. // Type of CEDAR
  897. #define CEDAR_CLIENT 0 // Client
  898. #define CEDAR_STANDALONE_SERVER 1 // Stand-alone server
  899. #define CEDAR_FARM_CONTROLLER 2 // Server farm controller
  900. #define CEDAR_FARM_MEMBER 3 // Server farm member
  901. ////////////////////////////
  902. // Read the header file
  903. // Type
  904. #include <Cedar/CedarType.h>
  905. // Account Manager
  906. #include <Cedar/Account.h>
  907. // Listener module
  908. #include <Cedar/Listener.h>
  909. // Log storage module
  910. #include <Cedar/Logging.h>
  911. // Connection management
  912. #include <Cedar/Connection.h>
  913. // Session Management
  914. #include <Cedar/Session.h>
  915. // RPC
  916. #include <Cedar/Remote.h>
  917. // HUB management
  918. #include <Cedar/Hub.h>
  919. // Security Accounts Manager
  920. #include <Cedar/Sam.h>
  921. // Radius authentication module
  922. #include <Cedar/Radius.h>
  923. // Protocol
  924. #include <Cedar/Protocol.h>
  925. // Inter-HUB link
  926. #include <Cedar/Link.h>
  927. // User-mode virtual host
  928. #include <Cedar/Virtual.h>
  929. // SecureNAT
  930. #include <Cedar/SecureNAT.h>
  931. // Digital watermark
  932. #include <Cedar/WaterMark.h>
  933. // Secure data
  934. #include <Cedar/SecureInfo.h>
  935. // Console service
  936. #include <Cedar/Console.h>
  937. // Vpncmd utility
  938. #include <Cedar/Command.h>
  939. // RPC over HTTP
  940. #include <Cedar/Wpc.h>
  941. // IPsec
  942. #include <Cedar/IPsec.h>
  943. #include <Cedar/IPsec_L2TP.h>
  944. #include <Cedar/IPsec_PPP.h>
  945. #include <Cedar/IPsec_IPC.h>
  946. #include <Cedar/IPsec_IkePacket.h>
  947. #include <Cedar/IPsec_IKE.h>
  948. #include <Cedar/IPsec_Win7.h>
  949. #include <Cedar/IPsec_EtherIP.h>
  950. // SSTP
  951. #include <Cedar/Interop_SSTP.h>
  952. // OpenVPN
  953. #include <Cedar/Interop_OpenVPN.h>
  954. // UDP Acceleration
  955. #include <Cedar/UdpAccel.h>
  956. // DDNS Client
  957. #include <Cedar/DDNS.h>
  958. // VPN Azure Client
  959. #include <Cedar/AzureClient.h>
  960. // VPN Azure Server
  961. #include <Cedar/AzureServer.h>
  962. // Native IP Stack
  963. #include <Cedar/NativeStack.h>
  964. #ifdef OS_WIN32
  965. // Neo device driver
  966. #include <Neo/Neo.h>
  967. // SeLow User-mode
  968. #include <Cedar/SeLowUser.h>
  969. #endif // OS_WIN32
  970. // Neo device driver manipulation library
  971. #include <Cedar/VLan.h>
  972. // Bridge
  973. #include <Cedar/Bridge.h>
  974. // Layer-3 switch
  975. #include <Cedar/Layer3.h>
  976. // Virtual LAN card for test
  977. #include <Cedar/NullLan.h>
  978. // Client
  979. #include <Cedar/Client.h>
  980. // Server
  981. #include <Cedar/Server.h>
  982. // License database
  983. #include <Cedar/Database.h>
  984. // EtherLogger
  985. #include <Cedar/EtherLog.h>
  986. // Management RPC
  987. #include <Cedar/Admin.h>
  988. // User-mode Router
  989. #include <Cedar/Nat.h>
  990. // Web UI
  991. #include <Cedar/WebUI.h>
  992. // VPN Gate Plugin DLL
  993. #include <VGate/VGateCommon.h>
  994. // VPN Gate Main Implementation
  995. #include <Cedar/VG.h>
  996. #ifdef OS_WIN32
  997. // Win32 user interface
  998. #include <Cedar/WinUi.h>
  999. // Win32 Client Connection Manager
  1000. #include <Cedar/CM.h>
  1001. // Win32 Server Manager
  1002. #include <Cedar/SM.h>
  1003. // Win32 User-mode Router Manager
  1004. #include <Cedar/NM.h>
  1005. // Win32 EtherLogger Manager
  1006. #include <Cedar/EM.h>
  1007. // Win32 Network Utility
  1008. #include <Cedar/UT.h>
  1009. // Win32 Setup Wizard
  1010. #include <Cedar/SW.h>
  1011. // Win32 COM calling module
  1012. #include <Cedar/Win32Com.h>
  1013. #endif
  1014. ////////////////////////////
  1015. // Function prototype
  1016. TRAFFIC *NewTraffic();
  1017. void FreeTraffic(TRAFFIC *t);
  1018. CEDAR *NewCedar(X *server_x, K *server_k);
  1019. void CedarForceLink();
  1020. void SetCedarVpnBridge(CEDAR *c);
  1021. void SetCedarCert(CEDAR *c, X *server_x, K *server_k);
  1022. void ReleaseCedar(CEDAR *c);
  1023. void CleanupCedar(CEDAR *c);
  1024. void StopCedar(CEDAR *c);
  1025. void AddListener(CEDAR *c, LISTENER *r);
  1026. void StopAllListener(CEDAR *c);
  1027. void AddTraffic(TRAFFIC *dst, TRAFFIC *diff);
  1028. void AddHub(CEDAR *c, HUB *h);
  1029. void DelHub(CEDAR *c, HUB *h);
  1030. void DelHubEx(CEDAR *c, HUB *h, bool no_lock);
  1031. void StopAllHub(CEDAR *c);
  1032. void StopAllConnection(CEDAR *c);
  1033. void AddConnection(CEDAR *cedar, CONNECTION *c);
  1034. UINT GetUnestablishedConnections(CEDAR *cedar);
  1035. void DelConnection(CEDAR *cedar, CONNECTION *c);
  1036. void SetCedarCipherList(CEDAR *cedar, char *name);
  1037. void InitCedar();
  1038. void FreeCedar();
  1039. void AddCa(CEDAR *cedar, X *x);
  1040. bool DeleteCa(CEDAR *cedar, UINT ptr);
  1041. bool CheckSignatureByCa(CEDAR *cedar, X *x);
  1042. bool CheckSignatureByCaLinkMode(SESSION *s, X *x);
  1043. X *FindCaSignedX(LIST *o, X *x);
  1044. void InitNetSvcList(CEDAR *cedar);
  1045. void FreeNetSvcList(CEDAR *cedar);
  1046. int CompareNetSvc(void *p1, void *p2);
  1047. char *GetSvcName(CEDAR *cedar, bool udp, UINT port);
  1048. void InitHiddenPassword(char *str, UINT size);
  1049. bool IsHiddenPasswordChanged(char *str);
  1050. UINT64 GetTrafficPacketSize(TRAFFIC *t);
  1051. UINT64 GetTrafficPacketNum(TRAFFIC *t);
  1052. void EnableDebugLog(CEDAR *c);
  1053. void StartCedarLog();
  1054. void StopCedarLog();
  1055. void CedarLog(char *str);
  1056. int CompareNoSslList(void *p1, void *p2);
  1057. void InitNoSslList(CEDAR *c);
  1058. void FreeNoSslList(CEDAR *c);
  1059. bool AddNoSsl(CEDAR *c, IP *ip);
  1060. void DecrementNoSsl(CEDAR *c, IP *ip, UINT num_dec);
  1061. void DeleteOldNoSsl(CEDAR *c);
  1062. NON_SSL *SearchNoSslList(CEDAR *c, IP *ip);
  1063. bool IsInNoSsl(CEDAR *c, IP *ip);
  1064. void FreeTinyLog(TINY_LOG *t);
  1065. void WriteTinyLog(TINY_LOG *t, char *str);
  1066. TINY_LOG *NewTinyLog();
  1067. void GetWinVer(RPC_WINVER *v);
  1068. bool IsSupportedWinVer(RPC_WINVER *v);
  1069. bool IsLaterBuild(CEDAR *c, UINT64 t);
  1070. SOCK *GetInProcListeningSock(CEDAR *c);
  1071. SOCK *GetReverseListeningSock(CEDAR *c);
  1072. void GetCedarVersion(char *tmp, UINT size);
  1073. UINT64 GetCurrentBuildDate();
  1074. void CedarAddCurrentTcpQueueSize(CEDAR *c, int diff);
  1075. UINT CedarGetCurrentTcpQueueSize(CEDAR *c);
  1076. void CedarAddQueueBudget(CEDAR *c, int diff);
  1077. void CedarAddFifoBudget(CEDAR *c, int diff);
  1078. UINT CedarGetQueueBudgetConsuming(CEDAR *c);
  1079. UINT CedarGetFifoBudgetConsuming(CEDAR *c);
  1080. UINT CedarGetQueueBudgetBalance(CEDAR *c);
  1081. UINT CedarGetFifoBudgetBalance(CEDAR *c);
  1082. bool CedarIsThereAnyEapEnabledRadiusConfig(CEDAR *c);
  1083. #endif // CEDAR_H