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
f50ae8a8
Commit
f50ae8a8
authored
Feb 25, 2014
by
Dmitrij D. Czarkoff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for OpenBSD
parent
eff4555d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
mtproto-client.c
mtproto-client.c
+11
-7
No files found.
mtproto-client.c
View file @
f50ae8a8
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#include <signal.h>
#include <signal.h>
#include <unistd.h>
#include <unistd.h>
#include <fcntl.h>
#include <fcntl.h>
#if
def __FreeBSD__
#if
defined(__FreeBSD__) || defined(__OpenBSD__)
#include <sys/endian.h>
#include <sys/endian.h>
#endif
#endif
#include <sys/types.h>
#include <sys/types.h>
...
@@ -58,6 +58,10 @@
...
@@ -58,6 +58,10 @@
#define __builtin_bswap32(x) bswap32(x)
#define __builtin_bswap32(x) bswap32(x)
#endif
#endif
#if defined(__OpenBSD__)
#define __builtin_bswap32(x) __swap32gen(x)
#endif
#define sha1 SHA1
#define sha1 SHA1
#include "mtproto-common.h"
#include "mtproto-common.h"
...
@@ -1720,7 +1724,7 @@ int rpc_execute (struct connection *c, int op, int len) {
...
@@ -1720,7 +1724,7 @@ int rpc_execute (struct connection *c, int op, int len) {
logprintf
(
"have %d Response bytes
\n
"
,
Response_len
);
logprintf
(
"have %d Response bytes
\n
"
,
Response_len
);
}
}
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined (__CYGWIN__)
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined
(__OpenBSD__) && !defined
(__CYGWIN__)
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
#endif
#endif
int
o
=
c_state
;
int
o
=
c_state
;
...
@@ -1728,19 +1732,19 @@ int rpc_execute (struct connection *c, int op, int len) {
...
@@ -1728,19 +1732,19 @@ int rpc_execute (struct connection *c, int op, int len) {
switch
(
o
)
{
switch
(
o
)
{
case
st_reqpq_sent
:
case
st_reqpq_sent
:
process_respq_answer
(
c
,
Response
/* + 8*/
,
Response_len
/* - 12*/
);
process_respq_answer
(
c
,
Response
/* + 8*/
,
Response_len
/* - 12*/
);
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined (__CYGWIN__)
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined
(__OpenBSD__) && !defined
(__CYGWIN__)
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
#endif
#endif
return
0
;
return
0
;
case
st_reqdh_sent
:
case
st_reqdh_sent
:
process_dh_answer
(
c
,
Response
/* + 8*/
,
Response_len
/* - 12*/
);
process_dh_answer
(
c
,
Response
/* + 8*/
,
Response_len
/* - 12*/
);
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined (__CYGWIN__)
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined
(__OpenBSD__) && !defined
(__CYGWIN__)
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
#endif
#endif
return
0
;
return
0
;
case
st_client_dh_sent
:
case
st_client_dh_sent
:
process_auth_complete
(
c
,
Response
/* + 8*/
,
Response_len
/* - 12*/
);
process_auth_complete
(
c
,
Response
/* + 8*/
,
Response_len
/* - 12*/
);
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined (__CYGWIN__)
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined
(__OpenBSD__) && !defined
(__CYGWIN__)
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
#endif
#endif
return
0
;
return
0
;
...
@@ -1750,7 +1754,7 @@ int rpc_execute (struct connection *c, int op, int len) {
...
@@ -1750,7 +1754,7 @@ int rpc_execute (struct connection *c, int op, int len) {
}
else
{
}
else
{
process_rpc_message
(
c
,
(
void
*
)(
Response
/* + 8*/
),
Response_len
/* - 12*/
);
process_rpc_message
(
c
,
(
void
*
)(
Response
/* + 8*/
),
Response_len
/* - 12*/
);
}
}
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined (__CYGWIN__)
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined
(__OpenBSD__) && !defined
(__CYGWIN__)
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
#endif
#endif
return
0
;
return
0
;
...
@@ -1778,7 +1782,7 @@ int tc_becomes_ready (struct connection *c) {
...
@@ -1778,7 +1782,7 @@ int tc_becomes_ready (struct connection *c) {
assert
(
write_out
(
c
,
&
byte
,
1
)
==
1
);
assert
(
write_out
(
c
,
&
byte
,
1
)
==
1
);
flush_out
(
c
);
flush_out
(
c
);
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined (__CYGWIN__)
#if !defined(__MACH__) && !defined(__FreeBSD__) && !defined
(__OpenBSD__) && !defined
(__CYGWIN__)
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
setsockopt
(
c
->
fd
,
IPPROTO_TCP
,
TCP_QUICKACK
,
(
int
[]){
0
},
4
);
#endif
#endif
int
o
=
c_state
;
int
o
=
c_state
;
...
...
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