Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
efdaafe0
Commit
efdaafe0
authored
Dec 17, 2013
by
Li-Wen Hsu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it compile on FreeBSD.
parent
d39a4e43
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
15 deletions
+25
-15
Makefile
Makefile
+5
-5
Makefile.in
Makefile.in
+2
-2
config.h
config.h
+1
-1
loop.c
loop.c
+1
-0
mtproto-client.c
mtproto-client.c
+12
-6
net.c
net.c
+4
-1
No files found.
Makefile
View file @
efdaafe0
srcdir
=
.
CFLAGS
=
-
g
-O2
LDFLAGS
=
CFLAGS
=
-
I
/usr/local/include
LDFLAGS
=
-L
/usr/local/lib
CPPFLAGS
=
DEFS
=
-DHAVE_CONFIG_H
COMPILE_FLAGS
=
${
CFLAGS
}
${
CPPFLAGS
}
${
DEFS
}
-Wall
-Wextra
-Werror
-
Wno-deprecated
-
fno-strict-aliasing
-fno-omit-frame-pointer
-ggdb
COMPILE_FLAGS
=
${
CFLAGS
}
${
CPPFLAGS
}
${
DEFS
}
-Wall
-Wextra
-Werror
-fno-strict-aliasing
-fno-omit-frame-pointer
-ggdb
EXTRA_LIBS
=
-lreadline
-lrt
-lconfig
LOCAL_LDFLAGS
=
-lm
-lcrypto
-lz
-lssl
-rdynamic
-ggdb
${
EXTRA_LIBS
}
EXTRA_LIBS
=
LOCAL_LDFLAGS
=
-lm
-lcrypto
-lz
-lssl
-rdynamic
-ggdb
-lconfig
-lreadline
-lexecinfo
${
EXTRA_LIBS
}
LINK_FLAGS
=
${
LDFLAGS
}
${
LOCAL_LDFLAGS
}
HEADERS
=
${
srcdir
}
/constants.h
${
srcdir
}
/include.h
${
srcdir
}
/interface.h
${
srcdir
}
/LICENSE.h
${
srcdir
}
/loop.h
${
srcdir
}
/mtproto-client.h
${
srcdir
}
/mtproto-common.h
${
srcdir
}
/net.h
${
srcdir
}
/no-preview.h
${
srcdir
}
/queries.h
${
srcdir
}
/structures.h
${
srcdir
}
/telegram.h
${
srcdir
}
/tree.h
${
srcdir
}
/config.h
${
srcdir
}
/binlog.h
...
...
Makefile.in
View file @
efdaafe0
...
...
@@ -4,10 +4,10 @@ CFLAGS=@CFLAGS@
LDFLAGS
=
@LDFLAGS@
CPPFLAGS
=
@CPPFLAGS@
DEFS
=
@DEFS@
COMPILE_FLAGS
=
${
CFLAGS
}
${
CPPFLAGS
}
${
DEFS
}
-Wall
-Wextra
-Werror
-
Wno-deprecated
-
fno-strict-aliasing
-fno-omit-frame-pointer
-ggdb
COMPILE_FLAGS
=
${
CFLAGS
}
${
CPPFLAGS
}
${
DEFS
}
-Wall
-Wextra
-Werror
-fno-strict-aliasing
-fno-omit-frame-pointer
-ggdb
EXTRA_LIBS
=
@EXTRA_LIBS@
LOCAL_LDFLAGS
=
-lm
-lcrypto
-lz
-lssl
-rdynamic
-ggdb
${
EXTRA_LIBS
}
LOCAL_LDFLAGS
=
-lm
-lcrypto
-lz
-lssl
-rdynamic
-ggdb
-lconfig
-lreadline
-lexecinfo
${
EXTRA_LIBS
}
LINK_FLAGS
=
${
LDFLAGS
}
${
LOCAL_LDFLAGS
}
HEADERS
=
${
srcdir
}
/constants.h
${
srcdir
}
/include.h
${
srcdir
}
/interface.h
${
srcdir
}
/LICENSE.h
${
srcdir
}
/loop.h
${
srcdir
}
/mtproto-client.h
${
srcdir
}
/mtproto-common.h
${
srcdir
}
/net.h
${
srcdir
}
/no-preview.h
${
srcdir
}
/queries.h
${
srcdir
}
/structures.h
${
srcdir
}
/telegram.h
${
srcdir
}
/tree.h
${
srcdir
}
/config.h
${
srcdir
}
/binlog.h
...
...
config.h
View file @
efdaafe0
...
...
@@ -24,7 +24,7 @@
#define HAVE_MALLOC 1
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* #undef HAVE_MALLOC_H */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
...
...
loop.c
View file @
efdaafe0
...
...
@@ -20,6 +20,7 @@
#include "config.h"
#include <assert.h>
#define _WITH_GETLINE
#include <stdio.h>
#include <stdlib.h>
...
...
mtproto-client.c
View file @
efdaafe0
...
...
@@ -26,6 +26,7 @@
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/endian.h>
#include <sys/types.h>
#include <aio.h>
#include <netdb.h>
...
...
@@ -34,6 +35,7 @@
#include <openssl/pem.h>
#include <openssl/sha.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <poll.h>
#include <zlib.h>
...
...
@@ -46,6 +48,10 @@
#include "structures.h"
#include "binlog.h"
#if defined(__FreeBSD__)
#define __builtin_bswap32(x) bswap32(x)
#endif
#define sha1 SHA1
#include "mtproto-common.h"
...
...
@@ -1589,7 +1595,7 @@ int rpc_execute (struct connection *c, int op, int len) {
logprintf
(
"have %d Response bytes
\n
"
,
Response_len
);
}
#if
ndef __MACH__
#if
!defined(__MACH__) && !defined(__FreeBSD__)
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
#endif
int
o
=
c_state
;
...
...
@@ -1597,19 +1603,19 @@ int rpc_execute (struct connection *c, int op, int len) {
switch
(
o
)
{
case
st_reqpq_sent
:
process_respq_answer
(
c
,
Response
/* + 8*/
,
Response_len
/* - 12*/
);
#if
ndef __MACH__
#if
!defined(__MACH__) && !defined(__FreeBSD__)
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
#endif
return
0
;
case
st_reqdh_sent
:
process_dh_answer
(
c
,
Response
/* + 8*/
,
Response_len
/* - 12*/
);
#if
ndef __MACH__
#if
!defined(__MACH__) && !defined(__FreeBSD__)
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
#endif
return
0
;
case
st_client_dh_sent
:
process_auth_complete
(
c
,
Response
/* + 8*/
,
Response_len
/* - 12*/
);
#if
ndef __MACH__
#if
!defined(__MACH__) && !defined(__FreeBSD__)
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
#endif
return
0
;
...
...
@@ -1619,7 +1625,7 @@ int rpc_execute (struct connection *c, int op, int len) {
}
else
{
process_rpc_message
(
c
,
(
void
*
)(
Response
/* + 8*/
),
Response_len
/* - 12*/
);
}
#if
ndef __MACH__
#if
!defined(__MACH__) && !defined(__FreeBSD__)
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
#endif
return
0
;
...
...
@@ -1647,7 +1653,7 @@ int tc_becomes_ready (struct connection *c) {
assert
(
write_out
(
c
,
&
byte
,
1
)
==
1
);
flush_out
(
c
);
#if
ndef __MACH__
#if
!defined(__MACH__) && !defined(__FreeBSD__)
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
#endif
int
o
=
c_state
;
...
...
net.c
View file @
efdaafe0
...
...
@@ -21,8 +21,11 @@
#include <stdlib.h>
#include <assert.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
...
...
@@ -37,7 +40,7 @@
#include "tree.h"
#include "interface.h"
#if
def __MACH__
#if
defined(__MACH__) || defined(__FreeBSD__)
#define POLLRDHUP 0
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment