PageRenderTime 77ms CodeModel.GetById 70ms app.highlight 3ms RepoModel.GetById 3ms app.codeStats 0ms

/src/Manos.IO/Manos.IO.Libev/SocketFunctions.cs

http://github.com/jacksonh/manos
C# | 47 lines | 34 code | 13 blank | 0 comment | 0 complexity | 0d26abc5f8676edeefcd6ce2e824f43b MD5 | raw file
 1using System;
 2using System.Runtime.InteropServices;
 3
 4namespace Manos.IO.Libev
 5{
 6	static class SocketFunctions
 7	{
 8		[DllImport ("libmanos", CallingConvention = CallingConvention.Cdecl)]
 9		public static extern int manos_socket_localname_ip (int fd, out ManosIPEndpoint ep, out int err);
10		
11		[DllImport ("libmanos", CallingConvention = CallingConvention.Cdecl)]
12		public static extern int manos_socket_peername_ip (int fd, out ManosIPEndpoint ep, out int err);
13		
14		[DllImport ("libmanos", CallingConvention = CallingConvention.Cdecl)]
15		public static extern int manos_socket_bind_ip (int fd, ref ManosIPEndpoint ep, out int err);
16		
17		[DllImport ("libmanos", CallingConvention = CallingConvention.Cdecl)]
18		public static extern int manos_socket_connect_ip (int fd, ref ManosIPEndpoint ep, out int err);
19		
20		[DllImport ("libmanos", CallingConvention = CallingConvention.Cdecl)]
21		public static extern int manos_socket_listen (int fd, int backlog, out int err);
22		
23		[DllImport ("libmanos", CallingConvention = CallingConvention.Cdecl)]
24		public static extern int manos_socket_accept (int fd, out ManosIPEndpoint remote, out int err);
25		
26		[DllImport ("libmanos", CallingConvention = CallingConvention.Cdecl)]
27		public static extern int manos_socket_create (int addressFamily, int protocolFamily, out int err);
28		
29		[DllImport ("libmanos", CallingConvention = CallingConvention.Cdecl)]
30		public static extern int manos_socket_send (int fd, byte[] buffer, int offset, int length, out int err);
31		
32		[DllImport ("libmanos", CallingConvention = CallingConvention.Cdecl)]
33		public static extern int manos_socket_receive (int fd, byte[] buffer, int length, out int err);
34		
35		[DllImport ("libmanos", CallingConvention = CallingConvention.Cdecl)]
36		public static extern int manos_socket_sendto_ip (int fd, byte[] buffer, int offset, int length,
37			ref ManosIPEndpoint to, out int err);
38		
39		[DllImport ("libmanos", CallingConvention = CallingConvention.Cdecl)]
40		public static extern int manos_socket_receivefrom_ip (int fd, byte[] buffer, int length,
41			out ManosIPEndpoint source, out int err);
42		
43		[DllImport ("libmanos", CallingConvention = CallingConvention.Cdecl)]
44		public static extern int manos_socket_close (int fd, out int err);
45	}
46}
47