ReactOS 0.4.16-dev-297-gc569aee
altcp_priv.h
Go to the documentation of this file.
1
10/*
11 * Copyright (c) 2017 Simon Goldschmidt
12 * All rights reserved.
13 *
14 * Redistribution and use in source and binary forms, with or without modification,
15 * are permitted provided that the following conditions are met:
16 *
17 * 1. Redistributions of source code must retain the above copyright notice,
18 * this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright notice,
20 * this list of conditions and the following disclaimer in the documentation
21 * and/or other materials provided with the distribution.
22 * 3. The name of the author may not be used to endorse or promote products
23 * derived from this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
26 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
28 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
30 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
33 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
34 * OF SUCH DAMAGE.
35 *
36 * This file is part of the lwIP TCP/IP stack.
37 *
38 * Author: Simon Goldschmidt <goldsimon@gmx.de>
39 *
40 */
41#ifndef LWIP_HDR_ALTCP_PRIV_H
42#define LWIP_HDR_ALTCP_PRIV_H
43
44#include "lwip/opt.h"
45
46#if LWIP_ALTCP /* don't build if not configured for use in lwipopts.h */
47
48#include "lwip/altcp.h"
49#include "lwip/ip_addr.h"
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
55struct altcp_pcb *altcp_alloc(void);
56void altcp_free(struct altcp_pcb *conn);
57
58/* Function prototypes for application layers */
59typedef void (*altcp_set_poll_fn)(struct altcp_pcb *conn, u8_t interval);
60typedef void (*altcp_recved_fn)(struct altcp_pcb *conn, u16_t len);
61typedef err_t (*altcp_bind_fn)(struct altcp_pcb *conn, const ip_addr_t *ipaddr, u16_t port);
62typedef err_t (*altcp_connect_fn)(struct altcp_pcb *conn, const ip_addr_t *ipaddr, u16_t port, altcp_connected_fn connected);
63
64typedef struct altcp_pcb *(*altcp_listen_fn)(struct altcp_pcb *conn, u8_t backlog, err_t *err);
65
66typedef void (*altcp_abort_fn)(struct altcp_pcb *conn);
67typedef err_t (*altcp_close_fn)(struct altcp_pcb *conn);
68typedef err_t (*altcp_shutdown_fn)(struct altcp_pcb *conn, int shut_rx, int shut_tx);
69
70typedef err_t (*altcp_write_fn)(struct altcp_pcb *conn, const void *dataptr, u16_t len, u8_t apiflags);
71typedef err_t (*altcp_output_fn)(struct altcp_pcb *conn);
72
73typedef u16_t (*altcp_mss_fn)(struct altcp_pcb *conn);
74typedef u16_t (*altcp_sndbuf_fn)(struct altcp_pcb *conn);
75typedef u16_t (*altcp_sndqueuelen_fn)(struct altcp_pcb *conn);
76typedef void (*altcp_nagle_disable_fn)(struct altcp_pcb *conn);
77typedef void (*altcp_nagle_enable_fn)(struct altcp_pcb *conn);
78typedef int (*altcp_nagle_disabled_fn)(struct altcp_pcb *conn);
79
80typedef void (*altcp_setprio_fn)(struct altcp_pcb *conn, u8_t prio);
81
82typedef void (*altcp_dealloc_fn)(struct altcp_pcb *conn);
83
84typedef err_t (*altcp_get_tcp_addrinfo_fn)(struct altcp_pcb *conn, int local, ip_addr_t *addr, u16_t *port);
85typedef ip_addr_t *(*altcp_get_ip_fn)(struct altcp_pcb *conn, int local);
86typedef u16_t (*altcp_get_port_fn)(struct altcp_pcb *conn, int local);
87
88#if LWIP_TCP_KEEPALIVE
89typedef void (*altcp_keepalive_disable_fn)(struct altcp_pcb *conn);
90typedef void (*altcp_keepalive_enable_fn)(struct altcp_pcb *conn, u32_t idle, u32_t intvl, u32_t count);
91#endif
92
93#ifdef LWIP_DEBUG
94typedef enum tcp_state (*altcp_dbg_get_tcp_state_fn)(struct altcp_pcb *conn);
95#endif
96
97struct altcp_functions {
98 altcp_set_poll_fn set_poll;
99 altcp_recved_fn recved;
100 altcp_bind_fn bind;
101 altcp_connect_fn connect;
102 altcp_listen_fn listen;
103 altcp_abort_fn abort;
104 altcp_close_fn close;
105 altcp_shutdown_fn shutdown;
106 altcp_write_fn write;
107 altcp_output_fn output;
108 altcp_mss_fn mss;
109 altcp_sndbuf_fn sndbuf;
110 altcp_sndqueuelen_fn sndqueuelen;
111 altcp_nagle_disable_fn nagle_disable;
112 altcp_nagle_enable_fn nagle_enable;
113 altcp_nagle_disabled_fn nagle_disabled;
114 altcp_setprio_fn setprio;
115 altcp_dealloc_fn dealloc;
116 altcp_get_tcp_addrinfo_fn addrinfo;
117 altcp_get_ip_fn getip;
118 altcp_get_port_fn getport;
119#if LWIP_TCP_KEEPALIVE
120 altcp_keepalive_disable_fn keepalive_disable;
121 altcp_keepalive_enable_fn keepalive_enable;
122#endif
123#ifdef LWIP_DEBUG
124 altcp_dbg_get_tcp_state_fn dbg_get_tcp_state;
125#endif
126};
127
128void altcp_default_set_poll(struct altcp_pcb *conn, u8_t interval);
129void altcp_default_recved(struct altcp_pcb *conn, u16_t len);
130err_t altcp_default_bind(struct altcp_pcb *conn, const ip_addr_t *ipaddr, u16_t port);
131err_t altcp_default_shutdown(struct altcp_pcb *conn, int shut_rx, int shut_tx);
132err_t altcp_default_write(struct altcp_pcb *conn, const void *dataptr, u16_t len, u8_t apiflags);
133err_t altcp_default_output(struct altcp_pcb *conn);
134u16_t altcp_default_mss(struct altcp_pcb *conn);
135u16_t altcp_default_sndbuf(struct altcp_pcb *conn);
136u16_t altcp_default_sndqueuelen(struct altcp_pcb *conn);
137void altcp_default_nagle_disable(struct altcp_pcb *conn);
138void altcp_default_nagle_enable(struct altcp_pcb *conn);
139int altcp_default_nagle_disabled(struct altcp_pcb *conn);
140void altcp_default_setprio(struct altcp_pcb *conn, u8_t prio);
141void altcp_default_dealloc(struct altcp_pcb *conn);
142err_t altcp_default_get_tcp_addrinfo(struct altcp_pcb *conn, int local, ip_addr_t *addr, u16_t *port);
143ip_addr_t *altcp_default_get_ip(struct altcp_pcb *conn, int local);
144u16_t altcp_default_get_port(struct altcp_pcb *conn, int local);
145#if LWIP_TCP_KEEPALIVE
146void altcp_default_keepalive_disable(struct altcp_pcb *conn);
147void altcp_default_keepalive_enable(struct altcp_pcb *conn, u32_t idle, u32_t intvl, u32_t count);
148#endif
149#ifdef LWIP_DEBUG
150enum tcp_state altcp_default_dbg_get_tcp_state(struct altcp_pcb *conn);
151#endif
152
153#ifdef __cplusplus
154}
155#endif
156
157#endif /* LWIP_ALTCP */
158
159#endif /* LWIP_HDR_ALTCP_PRIV_H */
#define close
Definition: acwin.h:98
#define write
Definition: acwin.h:97
#define altcp_pcb
Definition: altcp.h:159
#define altcp_connected_fn
Definition: altcp.h:153
void idle(int argc, const char *argv[])
Definition: cmds.c:1581
USHORT port
Definition: uri.c:228
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
void dealloc(int i, int no_throw)
Definition: ehthrow.cxx:33
#define local
Definition: zutil.h:30
int connected
Definition: main.c:61
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum const GLvoid * addr
Definition: glext.h:9621
GLenum GLsizei len
Definition: glext.h:6722
uint32_t u32_t
Definition: arch.h:129
uint8_t u8_t
Definition: arch.h:125
uint16_t u16_t
Definition: arch.h:127
s8_t err_t
Definition: err.h:96
#define abort()
Definition: i386-dis.c:34
ip6_addr_t ip_addr_t
Definition: ip_addr.h:344
int const JOCTET * dataptr
Definition: jpeglib.h:1031
#define err(...)
INT WSAAPI listen(IN SOCKET s, IN INT backlog)
Definition: sockctrl.c:123
INT WSAAPI shutdown(IN SOCKET s, IN INT how)
Definition: sockctrl.c:506
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36