mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
srs-librtmp: add make ssl/nossl support for sample
This commit is contained in:
parent
b7a62ba131
commit
f24f27deb9
8 changed files with 282 additions and 20 deletions
|
@ -28,6 +28,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
SimpleSocketStream::SimpleSocketStream()
|
||||
{
|
||||
|
@ -44,11 +46,101 @@ SimpleSocketStream::~SimpleSocketStream()
|
|||
|
||||
int SimpleSocketStream::create_socket()
|
||||
{
|
||||
fd = ::socket(AF_INET, SOCK_STREAM, 0);
|
||||
if(fd == -1){
|
||||
if((fd = ::socket(AF_INET, SOCK_STREAM, 0)) < 0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
int SimpleSocketStream::connect(const char* server_ip, int port)
|
||||
{
|
||||
sockaddr_in addr;
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
addr.sin_addr.s_addr = inet_addr(server_ip);
|
||||
|
||||
if(::connect(fd, (const struct sockaddr*)&addr, sizeof(sockaddr_in)) < 0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
// ISrsBufferReader
|
||||
int SimpleSocketStream::read(const void* buf, size_t size, ssize_t* nread)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// ISrsProtocolReader
|
||||
void SimpleSocketStream::set_recv_timeout(int64_t timeout_us)
|
||||
{
|
||||
}
|
||||
|
||||
int64_t SimpleSocketStream::get_recv_timeout()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t SimpleSocketStream::get_recv_bytes()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SimpleSocketStream::get_recv_kbps()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// ISrsProtocolWriter
|
||||
void SimpleSocketStream::set_send_timeout(int64_t timeout_us)
|
||||
{
|
||||
}
|
||||
|
||||
int64_t SimpleSocketStream::get_send_timeout()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t SimpleSocketStream::get_send_bytes()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SimpleSocketStream::get_send_kbps()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SimpleSocketStream::writev(const iovec *iov, int iov_size, ssize_t* nwrite)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// ISrsProtocolReaderWriter
|
||||
bool SimpleSocketStream::is_never_timeout(int64_t timeout_us)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int SimpleSocketStream::read_fully(const void* buf, size_t size, ssize_t* nread)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SimpleSocketStream::write(const void* buf, size_t size, ssize_t* nwrite)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue