{"id":18399268,"url":"https://github.com/phantom9999/thrift-cpp","last_synced_at":"2025-06-28T19:33:46.529Z","repository":{"id":98565646,"uuid":"93246074","full_name":"phantom9999/thrift-cpp","owner":"phantom9999","description":null,"archived":false,"fork":false,"pushed_at":"2017-06-05T15:20:12.000Z","size":2230,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-16T02:45:30.662Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phantom9999.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-03T12:15:59.000Z","updated_at":"2017-06-03T17:35:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"90f0128d-d4f0-4ddc-a00a-40d3ebe2a1bb","html_url":"https://github.com/phantom9999/thrift-cpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantom9999%2Fthrift-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantom9999%2Fthrift-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantom9999%2Fthrift-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantom9999%2Fthrift-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phantom9999","download_url":"https://codeload.github.com/phantom9999/thrift-cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248593411,"owners_count":21130310,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T02:26:28.438Z","updated_at":"2025-04-12T15:59:30.383Z","avatar_url":"https://github.com/phantom9999.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Thrift C++ Software Library\n\n# License\n\nLicensed to the Apache Software Foundation (ASF) under one\nor more contributor license agreements. See the NOTICE file\ndistributed with this work for additional information\nregarding copyright ownership. The ASF licenses this file\nto you under the Apache License, Version 2.0 (the\n\"License\"); you may not use this file except in compliance\nwith the License. You may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing,\nsoftware distributed under the License is distributed on an\n\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, either express or implied. See the License for the\nspecific language governing permissions and limitations\nunder the License.\n\n\n# Using Thrift with C++\n\nThe Thrift C++ libraries are built using the GNU tools. Follow the instructions\nin the top-level README.md\n\nIn case you do not want to open another README.md file, do this thrift src:\n\n    ./bootstrap.sh\n    ./configure (--with-boost=/usr/local)\n    make\n    sudo make install\n\nThrift is divided into two libraries.\n\n* libthrift - The core Thrift library contains all the core Thrift code. It requires\n  boost shared pointers, pthreads, and librt.\n\n* libthriftnb - This library contains the Thrift nonblocking server, which uses libevent.\n  To link this library you will also need to link libevent.\n\n## Linking Against Thrift\n\nAfter you build and install Thrift the libraries are installed to\n/usr/local/lib by default. Make sure this is in your LDPATH.\n\nOn Linux, the best way to do this is to ensure that /usr/local/lib is in\nyour /etc/ld.so.conf and then run /sbin/ldconfig.\n\nDepending upon whether you are linking dynamically or statically and how\nyour build environment it set up, you may need to include additional\nlibraries when linking against thrift, such as librt and/or libpthread. If\nyou are using libthriftnb you will also need libevent.\n\n## Dependencies\n\nboost shared pointers\nhttp://www.boost.org/libs/smart_ptr/smart_ptr.htm\n\nlibevent (for libthriftnb only)\nhttp://monkey.org/~provos/libevent/\n\n# Using Thrift with C++ on Windows\n\nYou need to define an environment variables for 3rd party components separately:\n\nBOOST_ROOT : For boost, e.g. D:\\boost_1_55_0\nOPENSSL_ROOT_DIR : For OpenSSL, e.g. D:\\OpenSSL-Win32\n\nonly required by libthriftnb:\n\nLIBEVENT_ROOT_DIR : For Libevent e.g. D:\\libevent-2.0.21-stable\n\nSee /3rdparty.user for more details.\n\nThrift is divided into two libraries.\n\n* libthrift - The core Thrift library contains all the core Thrift code. It requires\n  boost shared pointers, pthreads, and librt.\n\n* libthriftnb - This library contains the Thrift nonblocking server, which uses libevent.\n  To link this library you will also need to link libevent.\n\n## Linking Against Thrift\n\nYou need to link your project that uses thrift against all the thrift\ndependencies; in the case of libthrift, boost and for\nlibthriftnb, libevent.\n\nIn the project properties you must also set HAVE_CONFIG_H as force include\nthe config header: \"windows/confg.h\"\n\n## Dependencies\n\nboost shared pointers\nhttp://www.boost.org/libs/smart_ptr/smart_ptr.htm\n\nboost thread\nhttp://www.boost.org/doc/libs/release/doc/html/thread.html\n\nlibevent (for libthriftnb only)\nhttp://monkey.org/~provos/libevent/\n\n## Notes on boost thread (static vs shared):\n\nBy default lib/cpp/windows/force_inc.h defines:\n\n    #define BOOST_ALL_NO_LIB 1\n    #define BOOST_THREAD_NO_LIB 1\n\nThis has for effect to have the host application linking against Thrift\nto have to link with boost thread as a static library.\n\nIf you wanted instead to link with boost thread as a shared library,\nyou'll need to uncomment those two lines, and recompile.\n\n## Windows version compatibility\n\nThe Thrift library targets Windows XP for broadest compatbility. A notable\ndifference is in the Windows-specific implementation of the socket poll\nfunction. To target Vista, Win7 or other versions, comment out the line\n\n    #define TARGET_WIN_XP.\n\n## Named Pipes\n\nNamed Pipe transport has been added in the TPipe and TPipeServer classes. This\nis currently Windows-only. Named pipe transport for *NIX has not been\nimplemented. Domain sockets are a better choice for local IPC under non-Windows\nOS's. *NIX named pipes only support 1:1 client-server connection.\n\n# Thrift/SSL\n\n## Scope\n\nThis SSL only supports blocking mode socket I/O. It can only be used with\nTSimpleServer, TThreadedServer, and TThreadPoolServer.\n\n## Implementation\n\nThere're two main classes TSSLSocketFactory and TSSLSocket. Instances of\nTSSLSocket are always created from TSSLSocketFactory.\n\nPosixSSLThreadFactory creates PosixSSLThread. The only difference from the\nPthreadThread type is that it cleanups OpenSSL error queue upon exiting\nthe thread. Ideally, OpenSSL APIs should only be called from PosixSSLThread.\n\n## How to use SSL APIs\n\nThis is for demo. In real code, typically only one TSSLSocketFactory\ninstance is needed.\n\n    shared_ptr\u003cTSSLSocketFactory\u003e getSSLSocketFactory() {\n      shared_ptr\u003cTSSLSocketFactory\u003e factory(new TSSLSocketFactory());\n      // client: load trusted certificates\n      factory-\u003eloadTrustedCertificates(\"my-trusted-ca-certificates.pem\");\n      // client: optionally set your own access manager, otherwise,\n      //         the default client access manager will be loaded.\n\n      factory-\u003eloadCertificate(\"my-certificate-signed-by-ca.pem\");\n      factory-\u003eloadPrivateKey(\"my-private-key.pem\");\n      // server: optionally setup access manager\n      // shared_ptr\u003cAccessManager\u003e accessManager(new MyAccessManager);\n      // factory-\u003eaccess(accessManager);\n      ...\n    }\n\n\nclient code sample\n\n    shared_ptr\u003cTSSLSocketFactory\u003e factory = getSSLSocketFactory();\n    shared_ptr\u003cTSocket\u003e socket = factory.createSocket(host, port);\n    shared_ptr\u003cTBufferedTransport\u003e transport(new TBufferedTransport(socket));\n    ...\n\n\nserver code sample\n\n    shared_ptr\u003cTSSLSocketFactory\u003e factory = getSSLSocketFactory();\n    shared_ptr\u003cTSSLServerSocket\u003e socket(new TSSLServerSocket(port, factory));\n    shared_ptr\u003cTTransportFactory\u003e transportFactory(new TBufferedTransportFactory));\n    ...\n\n## AccessManager\n\nAccessManager defines a callback interface. It has three callback methods:\n\n(a) Decision verify(const sockaddr_storage\u0026 sa);\n\n(b) Decision verify(const string\u0026 host, const char* name, int size);\n\n(c) Decision verify(const sockaddr_storage\u0026 sa, const char* data, int size);\n\nAfter SSL handshake completes, additional checks are conducted. Application\nis given the chance to decide whether or not to continue the conversation\nwith the remote. Application is queried through the above three \"verify\"\nmethod. They are called at different points of the verification process.\n\nDecisions can be one of ALLOW, DENY, and SKIP. ALLOW and DENY means the\nconversation should be continued or disconnected, respectively. ALLOW and\nDENY decision stops the verification process. SKIP means there's no decision\nbased on the given input, continue the verification process.\n\nFirst, (a) is called with the remote IP. It is called once at the beginning.\n\"sa\" is the IP address of the remote peer.\n\nThen, the certificate of remote peer is loaded. SubjectAltName extensions\nare extracted and sent to application for verification. When a DNS\nsubjectAltName field is extracted, (b) is called. When an IP subjectAltName\nfield is extracted, (c) is called.\n\nThe \"host\" in (b) is the value from TSocket::getHost() if this is a client\nside socket, or TSocket::getPeerHost() if this is a server side socket. The\nreason is client side socket initiates the connection. TSocket::getHost()\nis the remote host name. On server side, the remote host name is unknown\nunless it's retrieved through TSocket::getPeerHost(). Either way, \"host\"\nshould be the remote host name. Keep in mind, if TSocket::getPeerHost()\nfailed, it would return the remote host name in numeric format.\n\nIf all subjectAltName extensions were \"skipped\", the common name field would\nbe checked. It is sent to application through (c), where \"sa\" is the remote\nIP address. \"data\" is the IP address extracted from subjectAltName IP\nextension, and \"size\" is the length of the extension data.\n\nIf any of the above \"verify\" methods returned a decision ALLOW or DENY, the\nverification process would be stopped.\n\nIf any of the above \"verify\" methods returned SKIP, that decision would be\nignored and the verification process would move on till the last item is\nexamined. At that point, if there's still no decision, the connection is\nterminated.\n\nThread safety, an access manager should not store state information if it's\nto be used by many SSL sockets.\n\n## SIGPIPE signal\n\nApplications running OpenSSL over network connections may crash if SIGPIPE\nis not ignored. This happens when they receive a connection reset by remote\npeer exception, which somehow triggers a SIGPIPE signal. If not handled,\nthis signal would kill the application.\n\n## How to run test client/server in SSL mode\n\nThe server and client expects the followings from the directory /test/\n\n- keys/server.crt\n- keys/server.key\n- keys/CA.pem\n\nThe file names are hard coded in the source code. You need to create these\ncertificates before you can run the test code in SSL mode. Make sure at least\none of the followings is included in \"keys/server.crt\",\n\n- subjectAltName, DNS localhost\n- subjectAltName, IP  127.0.0.1\n- common name,    localhost\n\nRun within /test/ folder,\n\n         ./cpp/TestServer --ssl \u0026\n         ./cpp/TestClient --ssl\n\nIf \"-h \u003chost\u003e\" is used to run client, the above \"localhost\" in the above\nkeys/server.crt has to be replaced with that host name.\n\n## TSSLSocketFactory::randomize()\n\nThe default implementation of OpenSSLSocketFactory::randomize() simply calls\nOpenSSL's RAND_poll() when OpenSSL library is first initialized.\n\nThe PRNG seed is key to the application security. This method should be\noverridden if it's not strong enough for you.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphantom9999%2Fthrift-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphantom9999%2Fthrift-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphantom9999%2Fthrift-cpp/lists"}