SCTC
the soundcloud.com terminal client
network.h
Go to the documentation of this file.
1 /*
2  SCTC - the soundcloud.com client
3  Copyright (C) 2015 Christian Eichler
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>
17 */
18 
26 #ifndef _NETWORK_H
27  #define _NETWORK_H
28  //\cond
29  #include <stdarg.h>
30  #include <stdbool.h> /* bool */
31  #include <stdlib.h>
32  //\endcond
33 
41  struct network_conn {
42  void *mdata;
43 
45  bool (*send) (struct network_conn *nwc, char *buffer, size_t buffer_len);
46 
48  bool (*send_fmt) (struct network_conn *nwc, char *fmt, ...);
49 
51  int (*recv) (struct network_conn *nwc, char *buffer, size_t buffer_len);
52 
54  int (*recv_byte) (struct network_conn *nwc);
55 
59  char* (*get_error_str) (struct network_conn *nwc);
60 
64  void (*disconnect)(struct network_conn *nwc);
65  };
66 #endif /* _NETWORK_H */
int(* recv)(struct network_conn *nwc, char *buffer, size_t buffer_len)
Recv data (at max. buffer_len Bytes) into buffer.
Definition: network.h:51
static volatile char * buffer
Definition: sound.c:61
bool(* send_fmt)(struct network_conn *nwc, char *fmt,...)
Send formatted data (string; see 'man 3 printf')
Definition: network.h:48
Definition: network.h:41
void * mdata
Pointer to data to be used by the implemention handling the actual connection.
Definition: network.h:42
void(* disconnect)(struct network_conn *nwc)
Definition: network.h:64
bool(* send)(struct network_conn *nwc, char *buffer, size_t buffer_len)
Send data (buffer_len Bytes) from buffer.
Definition: network.h:45
int(* recv_byte)(struct network_conn *nwc)
Definition: network.h:54