PageRenderTime 104ms CodeModel.GetById 9ms RepoModel.GetById 1ms app.codeStats 0ms

/bundle/rsense/rsense/stubs/1.8/socket.rb

https://github.com/junxuan/JxVim
Ruby | 461 lines | 337 code | 32 blank | 92 comment | 13 complexity | 2a096b55674fbe218b2b2d5f30874aff MD5 | raw file
  1. class BasicSocket < IO
  2. ##% self.do_not_reverse_lookup() -> Boolean
  3. def self.do_not_reverse_lookup() BOOLEAN end
  4. ##% self.do_not_reverse_lookup=(Boolean) -> Boolean
  5. def self.do_not_reverse_lookup(bool) bool end
  6. ##% self.for_fd(Integer) -> BasicSocket
  7. def self.for_fd(fd) BasicSocket.new(0) end
  8. ##% getpeername() -> String
  9. def getpeername() '' end
  10. ##% getsockname() -> String
  11. def getsockname() '' end
  12. ##% getsockopt(Integer, Integer) -> String
  13. def getsockopt(level, optname) '' end
  14. ##% recv(Integer, ?Integer) -> String
  15. def recv(maxlen, flags = 0) '' end
  16. ##% recv_nonblock(Integer, ?Integer) -> String
  17. def recv_nonblock(maxlen, flags = 0) '' end
  18. ##% send(String, Integer, ?String) -> Fixnum
  19. def send(mesg, flags, dest_sockaddr = nil) 0 end
  20. ##% setsockopt(Integer, Integer, String) -> Fixnum
  21. def getsockopt(level, optname, optval) 0 end
  22. ##% shutdown(?Integer) -> Fixnum
  23. def shutdown(how = Socket::SHUT_RDWR) 0 end
  24. end
  25. class IPSocket < BasicSocket
  26. ##% self.getaddress(String) -> String
  27. def self.getaddress(host) '' end
  28. ##% addr() -> (String, Integer, String, String)
  29. def addr() ['', 0, '', ''] end
  30. ##% peeraddr() -> (String, Integer, String, String)
  31. def peeraddr() ['', 0, '', ''] end
  32. ##% recvfrom(Integer, ?Integer) -> (String, (String, Integer, String, String))
  33. def recvfrom(maxlen, flags = 0) ['', ['', 0, '', '']] end
  34. end
  35. class TCPSocket < IPSocket
  36. ##% self.gethostbyname(String) -> (String, Array<String>, Integer, String)
  37. def self.gethostbyname(host) ['', [''], 0, ''] end
  38. ##% self.open(String, Integer or String, ?String, ?(Integer or String)) -> TCPSocket
  39. ##% self.open(String, Integer or String, ?String, ?(Integer or String)) {TCPSocket -> a} -> a
  40. def self.open(host, service, local_host = nil, local_service = nil)
  41. s = TCPSocket.new(host, service, local_host, local_service)
  42. (yield s) || s
  43. end
  44. ##% self.new(String, Integer or String, ?String, ?(Integer or String)) -> TCPSocket
  45. ##% self.new(String, Integer or String, ?String, ?(Integer or String)) {TCPSocket -> a} -> a
  46. def self.new(host, service, local_host = nil, local_service = nil)
  47. s = super()
  48. (yield s) || s
  49. end
  50. end
  51. class TCPServer < TCPSocket
  52. ##% self.new(Integer or String) -> TCPServer
  53. ##% self.new(Integer or String) {TCPServer -> a} -> a
  54. ##% self.new(String, Integer or String) -> TCPServer
  55. ##% self.new(String, Integer or String) {TCPServer -> a} -> a
  56. def self.new(*)
  57. s = super()
  58. (yield s) || s
  59. end
  60. ##% self.open(Integer or String) -> TCPServer
  61. ##% self.open(Integer or String) {TCPServer -> a} -> a
  62. ##% self.open(String, Integer or String) -> TCPServer
  63. ##% self.open(String, Integer or String) {TCPServer -> a} -> a
  64. def self.open(*)
  65. s = TCPServer.new(0)
  66. (yield s) || s
  67. end
  68. ##% accept() -> TCPSocket
  69. def accept() TCPSocket.new('', 0) end
  70. ##% accept_nonblock() -> TCPSocket
  71. def accept_nonblock() TCPSocket.new('', 0) end
  72. ##% listen(Integer) -> Fixnum
  73. def listen(backlog) 0 end
  74. ##% sysaccept() -> Fixnum
  75. def sysaccept() 0 end
  76. end
  77. class SOCKSSocket < TCPSocket
  78. ##% self.open(String, Integer or String) -> SOCKSSocket
  79. ##% self.open(String, Integer or String) {SOCKSSocket -> a} -> a
  80. def self.open(host, service)
  81. s = SOCKSSocket.new(host, service)
  82. (yield s) || s
  83. end
  84. ##% self.new(String, Integer or String) -> SOCKSSocket
  85. ##% self.new(String, Integer or String) {SOCKSSocket -> a} -> a
  86. def self.new(host, service)
  87. s = super()
  88. (yield s) || s
  89. end
  90. ##% close() -> nil
  91. def close() end
  92. end
  93. class UDPSocket < IPSocket
  94. ##% self.open(?Integer) -> UDPSocket
  95. ##% self.open(?Integer) {UDPSocket -> a} -> a
  96. def self.open(socktype = 0)
  97. s = UDPSocket.new
  98. (yield s) || s
  99. end
  100. ##% self.new(?Integer) -> UDPSocket
  101. ##% self.new(?Integer) {UDPSocket -> a} -> a
  102. def self.new(socktype = 0)
  103. s = super()
  104. (yield s) || s
  105. end
  106. ##% bind(String, Integer or String) -> Fixnum
  107. def bind(host, port) 0 end
  108. ##% connect(String, Integer or String) -> Fixnum
  109. def connect(host, port) 0 end
  110. ##% recvfrom_nonblock(Integer, ?Integer) -> (String, (String, Integer, String, String))
  111. def recvfrom_nonblock(maxlen, flags = 0) ['', ['', 0, '', '']] end
  112. ##% send(String, Integer, ?String) -> Fixnum
  113. ##% send(String, Integer, Integer or String, Integer or String) -> Fixnum
  114. def send(mesg, flags, *) 0 end
  115. end
  116. class UNIXSocket < BasicSocket
  117. ##% self.open(String) -> UNIXSocket
  118. ##% self.open(String) {UNIXSocket -> a} -> a
  119. def self.open(path)
  120. s = UNIXSocket.new(path)
  121. (yield s) || s
  122. end
  123. ##% self.new(String) -> UNIXSocket
  124. ##% self.new(String) {UNIXSocket -> a} -> a
  125. def self.new(path)
  126. s = super()
  127. (yield s) || s
  128. end
  129. ##% self.pair(?Integer, ?Integer) -> (UNIXSocket, UNIXSocket)
  130. def self.pair(type = 0, protocol = 0) [UNIXSocket.new(''), UNIXSocket.new('')] end
  131. ##% self.socketpair(?Integer, ?Integer) -> (UNIXSocket, UNIXSocket)
  132. def self.socketpair(type = 0, protocol = 0) [UNIXSocket.new(''), UNIXSocket.new('')] end
  133. ##% addr() -> (String, String)
  134. def addr() ['', ''] end
  135. ##% path() -> String
  136. def path() '' end
  137. ##% peeraddr() -> (String, String)
  138. def peeraddr() ['', ''] end
  139. ##% recv_io(?Class, ?Integer) -> Fixnum | IO
  140. def recv_io(klass = nil, mode = 0) 0 || IO.new(0) end
  141. ##% recvfrom(Integer, ?Integer) -> (String, String)
  142. def recvfrom(maxlen, flags = 0) ['', ''] end
  143. ##% send_io(IO) -> Fixnum
  144. def send_io(io) 0 end
  145. end
  146. class UNIXServer < UNIXSocket
  147. ##% self.open(String) -> UNIXServer
  148. ##% self.open(String) {UNIXServer -> a} -> a
  149. def self.open(path)
  150. s = UNIXServer.new(path)
  151. (yield s) || s
  152. end
  153. ##% self.new(String) -> UNIXServer
  154. ##% self.new(String) {UNIXServer -> a} -> a
  155. def self.new(path)
  156. s = super()
  157. (yield s) || s
  158. end
  159. ##% accept() -> UNIXSocket
  160. def accept() UNIXSocket.new('') end
  161. ##% accept_nonblock() -> UNIXSocket
  162. def accept_nonblock() UNIXSocket.new('') end
  163. ##% listen(Integer) -> Fixnum
  164. def listen(backlog) 0 end
  165. ##% sysaccept() -> Fixnum
  166. def sysaccept() 0 end
  167. end
  168. class Socket < BasicSocket
  169. module Constants
  170. AF_APPLETALK = 0
  171. AF_ATM = 0
  172. AF_AX25 = 0
  173. AF_CCITT = 0
  174. AF_CHAOS = 0
  175. AF_CNT = 0
  176. AF_COIP = 0
  177. AF_DATAKIT = 0
  178. AF_DEC = 0
  179. AF_DLI = 0
  180. AF_E164 = 0
  181. AF_ECMA = 0
  182. AF_HYLINK = 0
  183. AF_IMPLINK = 0
  184. AF_INET = 0
  185. AF_INET6 = 0
  186. AF_IPX = 0
  187. AF_ISDN = 0
  188. AF_ISO = 0
  189. AF_LAT = 0
  190. AF_LINK = 0
  191. AF_LOCAL = 0
  192. AF_MAX = 0
  193. AF_NATM = 0
  194. AF_NDRV = 0
  195. AF_NETBIOS = 0
  196. AF_NETGRAPH = 0
  197. AF_NS = 0
  198. AF_OSI = 0
  199. AF_PPP = 0
  200. AF_PUP = 0
  201. AF_ROUTE = 0
  202. AF_SIP = 0
  203. AF_SNA = 0
  204. AF_SYSTEM = 0
  205. AF_UNIX = 0
  206. AF_UNSPEC = 0
  207. AI_ADDRCONFIG = 0
  208. AI_ALL = 0
  209. AI_CANONNAME = 0
  210. AI_DEFAULT = 0
  211. AI_MASK = 0
  212. AI_NUMERICHOST = 0
  213. AI_PASSIVE = 0
  214. AI_V4MAPPED = 0
  215. AI_V4MAPPED_CFG = 0
  216. EAI_ADDRFAMILY = 0
  217. EAI_AGAIN = 0
  218. EAI_BADFLAGS = 0
  219. EAI_BADHINTS = 0
  220. EAI_FAIL = 0
  221. EAI_FAMILY = 0
  222. EAI_MAX = 0
  223. EAI_MEMORY = 0
  224. EAI_NODATA = 0
  225. EAI_NONAME = 0
  226. EAI_PROTOCOL = 0
  227. EAI_SERVICE = 0
  228. EAI_SOCKTYPE = 0
  229. EAI_SYSTEM = 0
  230. INADDR_ALLHOSTS_GROUP = 0
  231. INADDR_ANY = 0
  232. INADDR_BROADCAST = 0
  233. INADDR_LOOPBACK = 0
  234. INADDR_MAX_LOCAL_GROUP = 0
  235. INADDR_NONE = 0
  236. INADDR_UNSPEC_GROUP = 0
  237. IPPORT_RESERVED = 0
  238. IPPORT_USERRESERVED = 0
  239. IPPROTO_BIP = 0
  240. IPPROTO_EGP = 0
  241. IPPROTO_EON = 0
  242. IPPROTO_GGP = 0
  243. IPPROTO_HELLO = 0
  244. IPPROTO_ICMP = 0
  245. IPPROTO_IDP = 0
  246. IPPROTO_IGMP = 0
  247. IPPROTO_IP = 0
  248. IPPROTO_MAX = 0
  249. IPPROTO_ND = 0
  250. IPPROTO_PUP = 0
  251. IPPROTO_RAW = 0
  252. IPPROTO_TCP = 0
  253. IPPROTO_TP = 0
  254. IPPROTO_UDP = 0
  255. IPPROTO_XTP = 0
  256. MSG_COMPAT = 0
  257. MSG_CTRUNC = 0
  258. MSG_DONTROUTE = 0
  259. MSG_DONTWAIT = 0
  260. MSG_EOF = 0
  261. MSG_EOR = 0
  262. MSG_FLUSH = 0
  263. MSG_HAVEMORE = 0
  264. MSG_HOLD = 0
  265. MSG_OOB = 0
  266. MSG_PEEK = 0
  267. MSG_RCVMORE = 0
  268. MSG_SEND = 0
  269. MSG_TRUNC = 0
  270. MSG_WAITALL = 0
  271. NI_DGRAM = 0
  272. NI_MAXHOST = 0
  273. NI_MAXSERV = 0
  274. NI_NAMEREQD = 0
  275. NI_NOFQDN = 0
  276. NI_NUMERICHOST = 0
  277. NI_NUMERICSERV = 0
  278. PF_APPLETALK = 0
  279. PF_ATM = 0
  280. PF_AX25 = 0
  281. PF_CCITT = 0
  282. PF_CHAOS = 0
  283. PF_CNT = 0
  284. PF_COIP = 0
  285. PF_DATAKIT = 0
  286. PF_DEC = 0
  287. PF_DLI = 0
  288. PF_ECMA = 0
  289. PF_HYLINK = 0
  290. PF_IMPLINK = 0
  291. PF_INET = 0
  292. PF_INET6 = 0
  293. PF_IPX = 0
  294. PF_ISDN = 0
  295. PF_ISO = 0
  296. PF_KEY = 0
  297. PF_LAT = 0
  298. PF_LINK = 0
  299. PF_LOCAL = 0
  300. PF_MAX = 0
  301. PF_NATM = 0
  302. PF_NDRV = 0
  303. PF_NETBIOS = 0
  304. PF_NETGRAPH = 0
  305. PF_NS = 0
  306. PF_OSI = 0
  307. PF_PIP = 0
  308. PF_PPP = 0
  309. PF_PUP = 0
  310. PF_ROUTE = 0
  311. PF_RTIP = 0
  312. PF_SIP = 0
  313. PF_SNA = 0
  314. PF_SYSTEM = 0
  315. PF_UNIX = 0
  316. PF_UNSPEC = 0
  317. PF_XTP = 0
  318. SHUT_RD = 0
  319. SHUT_RDWR = 0
  320. SHUT_WR = 0
  321. SOCK_DGRAM = 0
  322. SOCK_PACKET = 0
  323. SOCK_RAW = 0
  324. SOCK_RDM = 0
  325. SOCK_SEQPACKET = 0
  326. SOCK_STREAM = 0
  327. SOL_ATALK = 0
  328. SOL_AX25 = 0
  329. SOL_IP = 0
  330. SOL_IPX = 0
  331. SOL_SOCKET = 0
  332. SOL_TCP = 0
  333. SOL_UDP = 0
  334. SOPRI_BACKGROUND = 0
  335. SOPRI_INTERACTIVE = 0
  336. SOPRI_NORMAL = 0
  337. SO_ACCEPTCONN = 0
  338. SO_ACCEPTFILTER = 0
  339. SO_ATTACH_FILTER = 0
  340. SO_BINDTODEVICE = 0
  341. SO_BROADCAST = 0
  342. SO_DEBUG = 0
  343. SO_DETACH_FILTER = 0
  344. SO_DONTROUTE = 0
  345. SO_DONTTRUNC = 0
  346. SO_ERROR = 0
  347. SO_KEEPALIVE = 0
  348. SO_LINGER = 0
  349. SO_NKE = 0
  350. SO_NOSIGPIPE = 0
  351. SO_NO_CHECK = 0
  352. SO_NREAD = 0
  353. SO_OOBINLINE = 0
  354. SO_PASSCRED = 0
  355. SO_PEERCRED = 0
  356. SO_PEERNAME = 0
  357. SO_PRIORITY = 0
  358. SO_RCVBUF = 0
  359. SO_RCVLOWAT = 0
  360. SO_RCVTIMEO = 0
  361. SO_REUSEADDR = 0
  362. SO_REUSEPORT = 0
  363. SO_SECURITY_AUTHENTICATION = 0
  364. SO_SECURITY_ENCRYPTION_NETWORK = 0
  365. SO_SECURITY_ENCRYPTION_TRANSPORT = 0
  366. SO_SNDBUF = 0
  367. SO_SNDLOWAT = 0
  368. SO_SNDTIMEO = 0
  369. SO_TIMESTAMP = 0
  370. SO_TYPE = 0
  371. SO_USELOOPBACK = 0
  372. SO_WANTMORE = 0
  373. SO_WANTOOBFLAG = 0
  374. TCP_MAXSEG = 0
  375. TCP_NODELAY = 0
  376. end
  377. include Constants
  378. ##% self.getaddrinfo(String or Integer, String or Integer, ?String, ?Integer, ?Integer, ?Integer) -> (String, Integer, String, String, Integer, Integer, Integer)
  379. def self.getaddrinfo(nodename, servname, family = nil, socktype = nil, protocol = nil, flags = nil) ['', 0, '', '', 0, 0, 0] end
  380. ##% self.gethostbyaddr(String, ?Integer) -> (String, Array<String>, Integer, String)
  381. def self.gethostbyaddr(host, type = nil) ['', [''], 0, ''] end
  382. ##% self.gethostbyname(String) -> (String, Array<String>, Integer, String)
  383. def self.gethostbyname(name) ['', [''], 0, ''] end
  384. ##% self.gethostname() -> String
  385. def self.gethostname() '' end
  386. ##% self.getnameinfo(String or Array, ?Integer) -> Array<String>
  387. def self.getnameinfo(sa, flags = nil) [''] end
  388. ##% self.getservbyname(String, ?Integer) -> Integer
  389. def self.getservbyname(service, proto = 0) 0 end
  390. ##% self.open(Integer or String, Integer or String, Integer) -> Socket
  391. def self.open(domain, type, protocol) Socket.new(domain, type, protocol) end
  392. ##% self.new(Integer or String, Integer or String, Integer) -> Socket
  393. def self.new(domain, type, protocol) super() end
  394. ##% self.sockaddr_in(Fixnum or String, String) -> String
  395. def self.sockaddr_in(port, host) '' end
  396. ##% self.pack_sockaddr_in(Fixnum or String, String) -> String
  397. def self.pack_sockaddr_in(port, host) '' end
  398. ##% self.sockaddr_un(String) -> String
  399. def self.sockaddr_un(path) '' end
  400. ##% self.pack_sockaddr_un(String) -> String
  401. def self.pack_sockaddr_un(path) '' end
  402. ##% self.pair(Integer or String, Integer or String, Integer) -> Socket
  403. def self.pair(domain, type, protocol) Socket.new(domain, type, protocol) end
  404. ##% self.socketpair(Integer or String, Integer or String, Integer) -> Socket
  405. def self.socketpair(domain, type, protocol) Socket.new(domain, type, protocol) end
  406. ##% self.unpack_sockaddr_in(String) -> (Fixnum, String)
  407. def self.unpack_sockaddr_in(sockaddr) [0, ''] end
  408. ##% self.unpack_sockaddr_un(String) -> String
  409. def self.unpack_sockaddr_un(sockaddr) String end
  410. # FIXME
  411. ##% accept() -> (Socket, String)
  412. def accept() [Socket.new(0, 0, 0), ''] end
  413. ##% accept_nonblock() -> (Socket, String)
  414. def accept_nonblock() [Socket.new(0, 0, 0), ''] end
  415. ##% bind(String) -> Fixnum
  416. def bind(my_sockaddr) 0 end
  417. ##% connect(String) -> Fixnum
  418. def connect(server_sockaddr) 0 end
  419. ##% connect_nonblock(String) -> Fixnum
  420. def connect_nonblock(server_sockaddr) 0 end
  421. ##% listen(Integer) -> Fixnum
  422. def listen(backlog) 0 end
  423. ##% recvfrom(Integer, ?Integer) -> (String, String)
  424. def recvfrom(maxlen, flags = 0) ['', ''] end
  425. ##% recvfrom_nonblock(Integer, ?Integer) -> (String, String)
  426. def recvfrom_nonblock(maxlen, flags = 0) ['', ''] end
  427. ##% sysaccept() -> (Fixnum, String)
  428. def sysaccept() [0, ''] end
  429. end