radare2/libr/include/r_socket.h
pancake 54bdfb22bd * Uppsercase classnames (rCore -> RCore)
- Fixes ruby warnings
  - Follow java syntax conventions
  - Helped to identify and fix bugs in many vapis
  - Sync swig examples
  - Add test-r_core.rb (ruby test for RCore)
* Some work in r_cons, some refactoring and cleanup
  - scr.html is now working again
  - w32 cons support should work now
  - Rename r_cons_get_columns -> r_cons_get_size()
  - But it needs more work
* Typedef all r_range, r_parse and r_anal structs
  - Add missing r_lib.pc in configure.acr
* 'make' clean now removes the libr* in swig/${LANG}/
2010-01-26 01:28:33 +01:00

46 lines
1.5 KiB
C

#ifndef _INCLUDE_SOCKET_H_
#define _INCLUDE_SOCKET_H_
#include "r_types.h"
/* TODO: major refactoring of r_socket */
/* make it work like the rest of apis */
/* struct r_socket_t *sock = r_socket_new(R_SOCKET_TCP, "gogle.com", 80); */
/* struct r_socket_t *sock = r_socket_proc_new(R_SOCKET_PROCESS, "/bin/ls", 80); */
#ifdef R_API
#if __UNIX__
R_API int r_socket_unix_connect(const char *file);
R_API int r_socket_unix_listen(const char *file);
#endif
R_API int r_socket_flush(int fd);
R_API void r_socket_block(int fd, int block);
R_API int r_socket_ready(int fd, int secs, int usecs);
R_API int r_socket_read(int fd, unsigned char *read, int len);
R_API int r_socket_puts(int fd, char *buf);
R_API int r_socket_write(int fd, void *buf, int len);
R_API int r_socket_connect(char *host, int port);
R_API int r_socket_listen(int port);
R_API int r_socket_accept(int fd);
R_API int r_socket_gets(int fd, char *buf, int size);
R_API void r_socket_printf(int fd, const char *fmt, ...);
R_API char *r_socket_to_string(int fd);
/* process */
struct r_socket_proc_t {
int fd0[2];
int fd1[2];
int pid;
};
R_API struct r_socket_proc_t *r_socket_proc_open(char *const argv[]);
R_API int r_socket_proc_close(struct r_socket_proc_t *sp);
#define r_socket_proc_read(x,y,z) r_socket_read(x->fd1[0],y,z)
#define r_socket_proc_gets(x,y,z) r_socket_gets(x->fd1[0],y,z)
#define r_socket_proc_write(x,y,z) r_socket_write(x->fd0[1],y,z)
#define r_socket_proc_printf(x,y) r_socket_printf(x->fd0[1],y)
#define r_socket_proc_ready(x,y,z) r_socket_ready(x->fd1[0],y,z)
#endif
#endif