GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
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 
62 serial_t *openserial(const char *path, int mode, char *msg);
63 
64 void closeserial(serial_t *serial);
65 
66 int readserial(serial_t *serial, unsigned char *buff, int n, char *msg);
67 
68 int writeserial(serial_t *serial, unsigned char *buff, int n, char *msg);
69 
70 int stateserial(serial_t *serial);
71 
72 int openfile_(file_t *file, gtime_t time, char *msg);
73 
74 void closefile_(file_t *file);
75 
76 file_t *openfile(const char *path, int mode, char *msg);
77 
78 void closefile(file_t *file);
79 
80 void swapfile(file_t *file, gtime_t time, char *msg);
81 
82 void swapclose(file_t *file);
83 
84 int statefile(file_t *file);
85 
86 int readfile(file_t *file, unsigned char *buff, int nmax, char *msg);
87 
88 int writefile(file_t *file, unsigned char *buff, int n, char *msg);
89 
90 void syncfile(file_t *file1, file_t *file2);
91 
92 void decodetcppath(const char *path, char *addr, char *port, char *user,
93  char *passwd, char *mntpnt, char *str);
94 
95 int errsock();
96 
97 int setsock(socket_t sock, char *msg);
98 
99 socket_t accept_nb(socket_t sock, struct sockaddr *addr, socklen_t *len);
100 
101 int connect_nb(socket_t sock, struct sockaddr *addr, socklen_t len);
102 
103 int recv_nb(socket_t sock, unsigned char *buff, int n);
104 
105 int send_nb(socket_t sock, unsigned char *buff, int n);
106 
107 int gentcp(tcp_t *tcp, int type, char *msg);
108 
109 void discontcp(tcp_t *tcp, int tcon);
110 
111 tcpsvr_t *opentcpsvr(const char *path, char *msg);
112 
113 void closetcpsvr(tcpsvr_t *tcpsvr);
114 
115 void updatetcpsvr(tcpsvr_t *tcpsvr, char *msg);
116 
117 int accsock(tcpsvr_t *tcpsvr, char *msg);
118 
119 int waittcpsvr(tcpsvr_t *tcpsvr, char *msg);
120 
121 int readtcpsvr(tcpsvr_t *tcpsvr, unsigned char *buff, int n, char *msg);
122 
123 int writetcpsvr(tcpsvr_t *tcpsvr, unsigned char *buff, int n, char *msg);
124 
125 int statetcpsvr(tcpsvr_t *tcpsvr);
126 
127 int consock(tcpcli_t *tcpcli, char *msg);
128 
129 tcpcli_t *opentcpcli(const char *path, char *msg);
130 
131 void closetcpcli(tcpcli_t *tcpcli);
132 
133 int waittcpcli(tcpcli_t *tcpcli, char *msg);
134 
135 int readtcpcli(tcpcli_t *tcpcli, unsigned char *buff, int n, char *msg);
136 
137 int writetcpcli(tcpcli_t *tcpcli, unsigned char *buff, int n, char *msg);
138 
139 int statetcpcli(tcpcli_t *tcpcli);
140 
141 int encbase64(char *str, const unsigned char *byte, int n);
142 
143 int reqntrip_s(ntrip_t *ntrip, char *msg);
144 
145 int reqntrip_c(ntrip_t *ntrip, char *msg);
146 
147 int rspntrip_s(ntrip_t *ntrip, char *msg);
148 
149 int rspntrip_c(ntrip_t *ntrip, char *msg);
150 
151 int waitntrip(ntrip_t *ntrip, char *msg);
152 
153 ntrip_t *openntrip(const char *path, int type, char *msg);
154 
155 void closentrip(ntrip_t *ntrip);
156 
157 int readntrip(ntrip_t *ntrip, unsigned char *buff, int n, char *msg);
158 
159 int writentrip(ntrip_t *ntrip, unsigned char *buff, int n, char *msg);
160 
161 int statentrip(ntrip_t *ntrip);
162 
163 void decodeftppath(const char *path, char *addr, char *file, char *user,
164  char *passwd, int *topts);
165 
166 gtime_t nextdltime(const int *topts, int stat);
167 
168 void *ftpthread(void *arg);
169 
170 ftp_t *openftp(const char *path, int type, char *msg);
171 
172 void closeftp(ftp_t *ftp);
173 
174 int readftp(ftp_t *ftp, unsigned char *buff, int n, char *msg);
175 
176 int stateftp(ftp_t *ftp);
177 
178 void strinitcom();
179 
180 void strinit(stream_t *stream);
181 
182 int stropen(stream_t *stream, int type, int mode, const char *path);
183 
184 void strclose(stream_t *stream);
185 
186 void strsync(stream_t *stream1, stream_t *stream2);
187 
188 void strlock(stream_t *stream);
189 
190 void strunlock(stream_t *stream);
191 
192 int strread(stream_t *stream, unsigned char *buff, int n);
193 
194 int strwrite(stream_t *stream, unsigned char *buff, int n);
195 
196 int strstat(stream_t *stream, char *msg);
197 
198 void strsum(stream_t *stream, int *inb, int *inr, int *outb, int *outr);
199 
200 void strsetopt(const int *opt);
201 
202 void strsettimeout(stream_t *stream, int inactive_timeout, int tirecon);
203 
204 void strsetdir(const char *dir);
205 
206 void strsetproxy(const char *addr);
207 
208 gtime_t strgettime(stream_t *stream);
209 
210 void strsendnmea(stream_t *stream, const double *pos);
211 
212 int gen_hex(const char *msg, unsigned char *buff);
213 
214 void strsendcmd(stream_t *str, const char *cmd);
215 
216 
217 #endif
main header file for the rtklib library
Definition: rtklib.h:1184
Definition: rtklib.h:1141