GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
rtklib_stream.h
Go to the documentation of this file.
1/*!
2 * \file rtklib_stream.h
3 * \brief streaming functions
4 * \authors <ul>
5 * <li> 2007-2013, T. Takasu
6 * <li> 2017, Javier Arribas
7 * <li> 2017, Carles Fernandez
8 * </ul>
9 *
10 * This is a derived work from RTKLIB http://www.rtklib.com/
11 * The original source code at https://github.com/tomojitakasu/RTKLIB is
12 * released under the BSD 2-clause license with an additional exclusive clause
13 * that does not apply here. This additional clause is reproduced below:
14 *
15 * " The software package includes some companion executive binaries or shared
16 * libraries necessary to execute APs on Windows. These licenses succeed to the
17 * original ones of these software. "
18 *
19 * Neither the executive binaries nor the shared libraries are required by, used
20 * or included in GNSS-SDR.
21 *
22 * -----------------------------------------------------------------------------
23 * Copyright (C) 2007-2013, T. Takasu
24 * Copyright (C) 2017, Javier Arribas
25 * Copyright (C) 2017, Carles Fernandez
26 * All rights reserved.
27 *
28 * SPDX-License-Identifier: BSD-2-Clause
29 *
30 *-----------------------------------------------------------------------------*/
31
32#ifndef GNSS_SDR_RTKLIB_STREAM_H
33#define GNSS_SDR_RTKLIB_STREAM_H
34
35#include "rtklib.h"
36
37/* constants -----------------------------------------------------------------*/
38
39#define TINTACT 200 /* period for stream active (ms) */
40#define SERIBUFFSIZE 4096 /* serial buffer size (bytes) */
41#define TIMETAGH_LEN 64 /* time tag file header length */
42#define MAXCLI 32 /* max client connection for tcp svr */
43#define MAXSTATMSG 32 /* max length of status message */
44
45#define VER_RTKLIB "2.4.2"
46#define NTRIP_AGENT "RTKLIB/" VER_RTKLIB
47#define NTRIP_CLI_PORT 2101 /* default ntrip-client connection port */
48#define NTRIP_SVR_PORT 80 /* default ntrip-server connection port */
49#define NTRIP_MAXRSP 32768 /* max size of ntrip response */
50#define NTRIP_MAXSTR 256 /* max length of mountpoint string */
51#define NTRIP_RSP_OK_CLI "ICY 200 OK\r\n" /* ntrip response: client */
52#define NTRIP_RSP_OK_SVR "OK\r\n" /* ntrip response: server */
53#define NTRIP_RSP_SRCTBL "SOURCETABLE 200 OK\r\n" /* ntrip response: source table */
54#define NTRIP_RSP_TBLEND "ENDSOURCETABLE"
55#define NTRIP_RSP_HTTP "HTTP/" /* ntrip response: http */
56#define NTRIP_RSP_ERROR "ERROR" /* ntrip response: error */
57
58#define FTP_CMD "wget" /* ftp/http command */
59#define FTP_TIMEOUT 30 /* ftp/http timeout (s) */
60
61
62serial_t *openserial(const char *path, int mode, char *msg);
63
64void closeserial(serial_t *serial);
65
66int readserial(serial_t *serial, unsigned char *buff, int n, char *msg);
67
68int writeserial(serial_t *serial, unsigned char *buff, int n, char *msg);
69
70int stateserial(serial_t *serial);
71
72int openfile_(file_t *file, gtime_t time, char *msg);
73
74void closefile_(file_t *file);
75
76file_t *openfile(const char *path, int mode, char *msg);
77
78void closefile(file_t *file);
79
80void swapfile(file_t *file, gtime_t time, char *msg);
81
82void swapclose(file_t *file);
83
84int statefile(file_t *file);
85
86int readfile(file_t *file, unsigned char *buff, int nmax, char *msg);
87
88int writefile(file_t *file, unsigned char *buff, int n, char *msg);
89
90void syncfile(file_t *file1, file_t *file2);
91
92void decodetcppath(const char *path, char *addr, char *port, char *user,
93 char *passwd, char *mntpnt, char *str);
94
95int errsock();
96
97int setsock(socket_t sock, char *msg);
98
99socket_t accept_nb(socket_t sock, struct sockaddr *addr, socklen_t *len);
100
101int connect_nb(socket_t sock, struct sockaddr *addr, socklen_t len);
102
103int recv_nb(socket_t sock, unsigned char *buff, int n);
104
105int send_nb(socket_t sock, unsigned char *buff, int n);
106
107int gentcp(tcp_t *tcp, int type, char *msg);
108
109void discontcp(tcp_t *tcp, int tcon);
110
111tcpsvr_t *opentcpsvr(const char *path, char *msg);
112
113void closetcpsvr(tcpsvr_t *tcpsvr);
114
115void updatetcpsvr(tcpsvr_t *tcpsvr, char *msg);
116
117int accsock(tcpsvr_t *tcpsvr, char *msg);
118
119int waittcpsvr(tcpsvr_t *tcpsvr, char *msg);
120
121int readtcpsvr(tcpsvr_t *tcpsvr, unsigned char *buff, int n, char *msg);
122
123int writetcpsvr(tcpsvr_t *tcpsvr, unsigned char *buff, int n, char *msg);
124
125int statetcpsvr(tcpsvr_t *tcpsvr);
126
127int consock(tcpcli_t *tcpcli, char *msg);
128
129tcpcli_t *opentcpcli(const char *path, char *msg);
130
131void closetcpcli(tcpcli_t *tcpcli);
132
133int waittcpcli(tcpcli_t *tcpcli, char *msg);
134
135int readtcpcli(tcpcli_t *tcpcli, unsigned char *buff, int n, char *msg);
136
137int writetcpcli(tcpcli_t *tcpcli, unsigned char *buff, int n, char *msg);
138
139int statetcpcli(tcpcli_t *tcpcli);
140
141int encbase64(char *str, const unsigned char *byte, int n);
142
143int reqntrip_s(ntrip_t *ntrip, char *msg);
144
145int reqntrip_c(ntrip_t *ntrip, char *msg);
146
147int rspntrip_s(ntrip_t *ntrip, char *msg);
148
149int rspntrip_c(ntrip_t *ntrip, char *msg);
150
151int waitntrip(ntrip_t *ntrip, char *msg);
152
153ntrip_t *openntrip(const char *path, int type, char *msg);
154
155void closentrip(ntrip_t *ntrip);
156
157int readntrip(ntrip_t *ntrip, unsigned char *buff, int n, char *msg);
158
159int writentrip(ntrip_t *ntrip, unsigned char *buff, int n, char *msg);
160
161int statentrip(ntrip_t *ntrip);
162
163void decodeftppath(const char *path, char *addr, char *file, char *user,
164 char *passwd, int *topts);
165
166gtime_t nextdltime(const int *topts, int stat);
167
168void *ftpthread(void *arg);
169
170ftp_t *openftp(const char *path, int type, char *msg);
171
172void closeftp(ftp_t *ftp);
173
174int readftp(ftp_t *ftp, unsigned char *buff, int n, char *msg);
175
176int stateftp(ftp_t *ftp);
177
178void strinitcom();
179
180void strinit(stream_t *stream);
181
182int stropen(stream_t *stream, int type, int mode, const char *path);
183
184void strclose(stream_t *stream);
185
186void strsync(stream_t *stream1, stream_t *stream2);
187
188void strlock(stream_t *stream);
189
190void strunlock(stream_t *stream);
191
192int strread(stream_t *stream, unsigned char *buff, int n);
193
194int strwrite(stream_t *stream, unsigned char *buff, int n);
195
196int strstat(stream_t *stream, char *msg);
197
198void strsum(stream_t *stream, int *inb, int *inr, int *outb, int *outr);
199
200void strsetopt(const int *opt);
201
202void strsettimeout(stream_t *stream, int inactive_timeout, int tirecon);
203
204void strsetdir(const char *dir);
205
206void strsetproxy(const char *addr);
207
208gtime_t strgettime(stream_t *stream);
209
210void strsendnmea(stream_t *stream, const double *pos);
211
212int gen_hex(const char *msg, unsigned char *buff);
213
214void strsendcmd(stream_t *str, const char *cmd);
215
216
217#endif
main header file for the rtklib library