Browse Source

Also Extern Identity, Destination, Streaming headers

pull/1669/head
idk 3 years ago
parent
commit
3330d2bb0c
No known key found for this signature in database
GPG Key ID: D75C03B39B5E14E1
  1. 11
      Makefile
  2. 9
      libi2pd/capi.cpp
  3. 9
      libi2pd/capi.h

11
Makefile

@ -82,6 +82,13 @@ api_client: mk_obj_dir $(SHLIB) $(ARLIB) $(SHLIB_CLIENT) $(ARLIB_CLIENT)
obj/%.o: %.cpp obj/%.o: %.cpp
$(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -c -o $@ $<
flags:
@echo $(CXXFLAGS)
@echo $(NEEDED_CXXFLAGS)
@echo $(INCFLAGS)
@echo $(LDFLAGS)
@echo $(LDLIBS)
# '-' is 'ignore if missing' on first run # '-' is 'ignore if missing' on first run
-include $(DEPS) -include $(DEPS)
@ -139,5 +146,7 @@ doxygen:
##TODO: delete this before a PR ##TODO: delete this before a PR
testc: api api_client testc: api api_client
g++ -Ii18n -c test.c -o test.o # g++ -Ii18n -c test.c -o test.o
gcc -Ii18n -c _test.c -o test.o
# gcc -Ii18n -I/usr/include/c++/10 -I/usr/include/x86_64-linux-gnu/c++/10 -llibi2pd.a -c test.c -o test.o
g++ test.o libi2pd.so libi2pdclient.so -o test.main g++ test.o libi2pd.so libi2pdclient.so -o test.main

9
libi2pd/capi.cpp

@ -6,6 +6,7 @@
* See full license text in LICENSE file at top of project tree * See full license text in LICENSE file at top of project tree
*/ */
#include "api.h"
#include "capi.h" #include "capi.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -22,10 +23,10 @@ void C_TerminateI2P ()
return i2p::api::TerminateI2P(); return i2p::api::TerminateI2P();
} }
void C_StartI2P (std::ostream *logStream) void C_StartI2P ()//std::ostream *logStream)
{ {
std::shared_ptr<std::ostream> cppLogStream(logStream); // std::shared_ptr<std::ostream> cppLogStream(logStream);
return i2p::api::StartI2P(cppLogStream); return i2p::api::StartI2P(nullptr);
} }
void C_StopI2P () void C_StopI2P ()
@ -80,7 +81,7 @@ void C_DestroyStream (i2p::stream::Stream *stream)
return i2p::api::DestroyStream(cppStream); return i2p::api::DestroyStream(cppStream);
} }
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

9
libi2pd/capi.h

@ -9,17 +9,18 @@
#ifndef CAPI_H__ #ifndef CAPI_H__
#define CAPI_H__ #define CAPI_H__
#include "api.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include "Identity.h"
#include "Destination.h"
#include "Streaming.h"
// initialization start and stop // initialization start and stop
void C_InitI2P (int argc, char* argv[], const char * appName); void C_InitI2P (int argc, char* argv[], const char * appName);
void C_TerminateI2P (); void C_TerminateI2P ();
void C_StartI2P (std::ostream *logStream = nullptr); void C_StartI2P (); //std::ostream *logStream = nullptr);
// write system log to logStream, if not specified to <appName>.log in application's folder // write system log to logStream, if not specified to <appName>.log in application's folder
void C_StopI2P (); void C_StopI2P ();
void C_RunPeerTest (); // should be called after UPnP void C_RunPeerTest (); // should be called after UPnP

Loading…
Cancel
Save