summaryrefslogtreecommitdiffstatshomepage
path: root/unix
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-02-08 21:10:18 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-02-08 21:20:32 +0200
commit9945f338863cd1bc0ce483c0eb70c41fbdb710f1 (patch)
treeed6068ff4cc1888cbbea17c635b7b5752434b81a /unix
parent0a587b85fb19e57644ac420c642d0d75d2f9346f (diff)
downloadmicropython-9945f338863cd1bc0ce483c0eb70c41fbdb710f1.tar.gz
micropython-9945f338863cd1bc0ce483c0eb70c41fbdb710f1.zip
Rename "rawsocket" module to "microsocket".
It's no longer intended to provide just "raw" socket interface, may include some convenience methods for compatibility with CPython socket - but anyway just minimal set required to deal with socket client and servers, not wider network functionality.
Diffstat (limited to 'unix')
-rw-r--r--unix/main.c4
-rw-r--r--unix/qstrdefsport.h2
-rw-r--r--unix/socket.c16
3 files changed, 11 insertions, 11 deletions
diff --git a/unix/main.c b/unix/main.c
index 9fb25a43e2..5fdfbc36aa 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -23,7 +23,7 @@
extern const mp_obj_fun_native_t mp_builtin_open_obj;
void file_init();
-void rawsocket_init();
+void microsocket_init();
void time_init();
void ffi_init();
@@ -265,7 +265,7 @@ int main(int argc, char **argv) {
rt_store_name(qstr_from_str("qstr_info"), rt_make_function_n(0, qstr_info));
file_init();
- rawsocket_init();
+ microsocket_init();
#if MICROPY_MOD_TIME
time_init();
#endif
diff --git a/unix/qstrdefsport.h b/unix/qstrdefsport.h
index 598f23bef2..9f28c607e2 100644
--- a/unix/qstrdefsport.h
+++ b/unix/qstrdefsport.h
@@ -12,4 +12,4 @@ Q(htons)
Q(inet_aton)
Q(gethostbyname)
Q(getaddrinfo)
-Q(rawsocket)
+Q(microsocket)
diff --git a/unix/socket.c b/unix/socket.c
index 28749f3bef..c38e38a0a1 100644
--- a/unix/socket.c
+++ b/unix/socket.c
@@ -24,7 +24,7 @@ typedef struct _mp_obj_socket_t {
int fd;
} mp_obj_socket_t;
-static const mp_obj_type_t rawsocket_type;
+static const mp_obj_type_t microsocket_type;
// Helper functions
#define RAISE_ERRNO(err_flag, error_val) \
@@ -48,7 +48,7 @@ error:
static mp_obj_socket_t *socket_new(int fd) {
mp_obj_socket_t *o = m_new_obj(mp_obj_socket_t);
- o->base.type = &rawsocket_type;
+ o->base.type = &microsocket_type;
o->fd = fd;
return o;
}
@@ -208,7 +208,7 @@ static mp_obj_t socket_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
return socket_new(fd);
}
-static const mp_method_t rawsocket_type_methods[] = {
+static const mp_method_t microsocket_type_methods[] = {
{ "read", &mp_stream_read_obj },
{ "readall", &mp_stream_readall_obj },
{ "readline", &mp_stream_unbuffered_readline_obj},
@@ -228,7 +228,7 @@ static const mp_method_t rawsocket_type_methods[] = {
{ NULL, NULL },
};
-static const mp_obj_type_t rawsocket_type = {
+static const mp_obj_type_t microsocket_type = {
{ &mp_const_type },
"socket",
.print = socket_print,
@@ -239,7 +239,7 @@ static const mp_obj_type_t rawsocket_type = {
.read = socket_read,
.write = socket_write,
},
- .methods = rawsocket_type_methods,
+ .methods = microsocket_type_methods,
};
static mp_obj_t mod_socket_htons(mp_obj_t arg) {
@@ -351,9 +351,9 @@ struct sym_entry {
#undef C
-void rawsocket_init() {
- mp_obj_t m = mp_obj_new_module(MP_QSTR_rawsocket);
- rt_store_attr(m, MP_QSTR_socket, (mp_obj_t)&rawsocket_type);
+void microsocket_init() {
+ mp_obj_t m = mp_obj_new_module(MP_QSTR_microsocket);
+ rt_store_attr(m, MP_QSTR_socket, (mp_obj_t)&microsocket_type);
#if MICROPY_SOCKET_EXTRA
rt_store_attr(m, MP_QSTR_sockaddr_in, (mp_obj_t)&sockaddr_in_type);
rt_store_attr(m, MP_QSTR_htons, (mp_obj_t)&mod_socket_htons_obj);