3 * Copyright (C) James R. Leu 2000
6 * This software is covered under the LGPL, for more
7 * info check out http://www.gnu.org/copyleft/lgpl.html
10 #ifndef _MPLS_SOCKET_IMPL_H_
11 #define _MPLS_SOCKET_IMPL_H_
13 #include "ldp_struct.h"
14 #include "mpls_struct.h"
18 * return: mpls_socket_mgr_handle
20 extern mpls_socket_mgr_handle
mpls_socket_mgr_open(const mpls_instance_handle
26 extern void mpls_socket_mgr_close(const mpls_socket_mgr_handle handle
);
30 * return: mpls_socket_handle
32 extern mpls_socket_handle
mpls_socket_create_tcp(const mpls_socket_mgr_handle
37 * return: mpls_socket_handle
39 extern mpls_socket_handle
mpls_socket_create_udp(const mpls_socket_mgr_handle
44 * return: mpls_socket_handle
46 extern mpls_socket_handle
mpls_socket_create_raw(const mpls_socket_mgr_handle
50 * in: handle,socket,from
52 * return: mpls_socket_handle
54 extern mpls_socket_handle
mpls_socket_tcp_accept(const mpls_socket_mgr_handle
55 handle
, const mpls_socket_handle socket
, mpls_dest
* from
);
60 extern void mpls_socket_close(const mpls_socket_mgr_handle handle
,
61 mpls_socket_handle socket
);
64 * in: handle,socket,local
65 * return: mpls_return_enum
67 extern mpls_return_enum
mpls_socket_bind(const mpls_socket_mgr_handle handle
,
68 mpls_socket_handle socket
, const mpls_dest
* local
);
71 * in: handle, socket, flag
72 * return: mpls_return_enum
74 extern mpls_return_enum
mpls_socket_options(const mpls_socket_mgr_handle handle
,
75 mpls_socket_handle socket
, const uint32_t flag
);
78 * in: handle, socket, depth
79 * return: mpls_return_enum
81 extern mpls_return_enum
mpls_socket_tcp_listen(const mpls_socket_mgr_handle handle
,
82 mpls_socket_handle socket
, const int depth
);
85 * in: handle, socket, to
86 * return: mpls_return_enum
88 extern mpls_return_enum
mpls_socket_tcp_connect(const mpls_socket_mgr_handle
89 handle
, mpls_socket_handle socket
, const mpls_dest
* to
);
95 extern int mpls_socket_get_errno(const mpls_socket_mgr_handle handle
,
96 mpls_socket_handle socket
);
100 * return: mpls_return_enum
102 extern mpls_return_enum
mpls_socket_connect_status(const mpls_socket_mgr_handle
103 handle
, mpls_socket_handle socket
);
106 * in: handle, socket, ttl, loop
107 * return: mpls_return_enum
109 extern mpls_return_enum
mpls_socket_multicast_options(const mpls_socket_mgr_handle handle
, mpls_socket_handle socket
, const int ttl
, const int loop
);
112 * in: handle, socket, iff
113 * return: mpls_return_enum
115 extern mpls_return_enum
mpls_socket_multicast_if_tx(const mpls_socket_mgr_handle
116 handle
, mpls_socket_handle socket
, const ldp_if
* iff
);
119 * in: handle, socket, iff, mult
120 * return: mpls_return_enum
122 extern mpls_return_enum
mpls_socket_multicast_if_join(const mpls_socket_mgr_handle handle
, mpls_socket_handle socket
, const ldp_if
* iff
,
123 const mpls_inet_addr
* mult
);
126 * in: handle, socket, iff, mult
128 extern void mpls_socket_multicast_if_drop(const mpls_socket_mgr_handle handle
,
129 mpls_socket_handle socket
, const ldp_if
* iff
, const mpls_inet_addr
* mult
);
132 * in: handle, socket, object, type
133 * return: mpls_return_enum
135 extern mpls_return_enum
mpls_socket_readlist_add(const mpls_socket_mgr_handle
136 handle
, mpls_socket_handle socket
, void *object
, const mpls_socket_enum type
);
141 extern void mpls_socket_readlist_del(const mpls_socket_mgr_handle handle
,
142 mpls_socket_handle socket
);
145 * in: handle, socket, object, type
146 * return: mpls_return_enum
148 extern mpls_return_enum
mpls_socket_writelist_add(const mpls_socket_mgr_handle
149 handle
, mpls_socket_handle socket
, void *object
, const mpls_socket_enum type
);
154 extern void mpls_socket_writelist_del(const mpls_socket_mgr_handle handle
,
155 mpls_socket_handle socket
);
161 extern int mpls_socket_tcp_read(const mpls_socket_mgr_handle handle
,
162 mpls_socket_handle socket
, uint8_t * buffer
, const int size
);
168 extern int mpls_socket_tcp_write(const mpls_socket_mgr_handle handle
,
169 mpls_socket_handle socket
, uint8_t * buffer
, const int size
);
175 extern int mpls_socket_udp_sendto(const mpls_socket_mgr_handle handle
,
176 mpls_socket_handle socket
, uint8_t * buffer
,
178 const int size
, const mpls_dest
* to
);
184 extern int mpls_socket_udp_recvfrom(const mpls_socket_mgr_handle handle
,
185 mpls_socket_handle socket
, uint8_t * buffer
, const int size
, mpls_dest
* from
);
187 extern mpls_return_enum
188 mpls_socket_get_local_name(const mpls_socket_mgr_handle handle
,
189 mpls_socket_handle socket
, mpls_dest
*name
);
191 extern mpls_return_enum
192 mpls_socket_get_remote_name(const mpls_socket_mgr_handle handle
,
193 mpls_socket_handle socket
, mpls_dest
*name
);