summaryrefslogtreecommitdiffstatshomepage
path: root/unix/modsocket.c
Commit message (Collapse)AuthorAge
* all: Rename mp_obj_type_t::stream_p to protocol.Paul Sokolovsky2016-06-18
| | | | | It's now used for more than just stream protocol (e.g. pin protocol), so don't use false names.
* unix/modsocket: Use mp_const_empty_map instead of creating empty map.Paul Sokolovsky2016-04-04
|
* unix/modsocket: Add comment regarding close() error checking (which is none).Paul Sokolovsky2016-03-02
|
* unix/modsocket: sockaddr(): Handle AF_INET6 addresses.Paul Sokolovsky2016-01-27
|
* unix/modsocket: accept(): Make IPv6-clean.Paul Sokolovsky2016-01-21
| | | | By reserving enough space for peer address.
* unix: Add socket.inet_ntop functionDave Hylands2016-01-11
|
* py: Change first arg of type.make_new from mp_obj_t to mp_obj_type_t*.Damien George2016-01-11
| | | | | | | | The first argument to the type.make_new method is naturally a uPy type, and all uses of this argument cast it directly to a pointer to a type structure. So it makes sense to just have it a pointer to a type from the very beginning (and a const pointer at that). This patch makes such a change, and removes all unnecessary casting to/from mp_obj_t.
* py: Change type signature of builtin funs that take variable or kw args.Damien George2016-01-11
| | | | | With this patch the n_args parameter is changed type from mp_uint_t to size_t.
* py: Change type of .make_new and .call args: mp_uint_t becomes size_t.Damien George2016-01-11
| | | | | | | This patch changes the type signature of .make_new and .call object method slots to use size_t for n_args and n_kw (was mp_uint_t. Makes code more efficient when mp_uint_t is larger than a machine word. Doesn't affect ports when size_t and mp_uint_t have the same size.
* py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.Damien George2015-11-29
| | | | | | | | | This allows the mp_obj_t type to be configured to something other than a pointer-sized primitive type. This patch also includes additional changes to allow the code to compile when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of mp_uint_t, and various casts.
* py: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George2015-11-29
|
* unix/modsocket: Use snprintf(), as defined by lib/utils/printf.c.Paul Sokolovsky2015-11-21
|
* unix/modsocket: Implement sockaddr() function to decode raw socket address.Paul Sokolovsky2015-11-21
| | | | | | | | Return tuple of (address_family, net_addr, [port, [extra_data]]). net_addr is still raw network address as bytes object, but suitable for passing to inet_ntop() function. At the very least, sockaddr() will separate address family value from binary socket address (and currently, only AF_INET family is decoded).
* unix/modsocket: Removed dangling references to sockaddr_in_type.Paul Sokolovsky2015-11-20
|
* unix/modsocket: Fix usage of pointers to locals outside scopeAnmol Sarma2015-10-10
|
* unix: modsocket: Implement inet_pton() in preference of inet_aton().Paul Sokolovsky2015-07-15
| | | | | | | | inet_pton supports both ipv4 and ipv6 addresses. Interface is also extensible for other address families, but underlying libc inet_pton() function isn't really extensible (e.g., it doesn't return length of binary address, i.e. it's really hardcoded to AF_INET and AF_INET6). But anyway, on Python side, we could extend it to support other addresses.
* unix: modsocket: Implement recvfrom().Paul Sokolovsky2015-07-14
| | | | Required to implement UDP servers.
* unix: modsocket: Implement sendto().Paul Sokolovsky2015-07-12
| | | | | | | | | sendto() turns out to be mandatory function to work with UDP. It may seem that connect(addr) + send() would achieve the same effect, but what connect() appears to do is to set source address filter on a socket to its argument. Then everything falls apart: socket sends to a broad-/multi-cast address, but reply is sent from real peer address, which doesn't match filter set by connect(), so local socket never sees a reply.
* unix: socket.getaddrinfo: Port is unsigned value.Paul Sokolovsky2015-07-11
| | | | Treating it as signed lead to buffer overflow for ports >= 32768.
* unix: socket.getaddrinfo: Accept family & socktype arguments.Paul Sokolovsky2015-07-10
| | | | This usually allows to get just a single address entry.
* py: Overhaul and simplify printf/pfenv mechanism.Damien George2015-04-16
| | | | | | | | | | | | | | | | | | | | | | Previous to this patch the printing mechanism was a bit of a tangled mess. This patch attempts to consolidate printing into one interface. All (non-debug) printing now uses the mp_print* family of functions, mainly mp_printf. All these functions take an mp_print_t structure as their first argument, and this structure defines the printing backend through the "print_strn" function of said structure. Printing from the uPy core can reach the platform-defined print code via two paths: either through mp_sys_stdout_obj (defined pert port) in conjunction with mp_stream_write; or through the mp_plat_print structure which uses the MP_PLAT_PRINT_STRN macro to define how string are printed on the platform. The former is only used when MICROPY_PY_IO is defined. With this new scheme printing is generally more efficient (less layers to go through, less arguments to pass), and, given an mp_print_t* structure, one can call mp_print_str for efficiency instead of mp_printf("%s", ...). Code size is also reduced by around 200 bytes on Thumb2 archs.
* py, unix: Allow to compile with -Wunused-parameter.Damien George2015-01-20
| | | | See issue #699.
* unix: Prefix includes with py/; remove need for -I../py.Damien George2015-01-01
|
* py: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* py: Rename mp_obj_int_get to mp_obj_int_get_truncated; fix struct.pack.Damien George2014-12-05
| | | | | | | | | | | mp_obj_int_get_truncated is used as a "fast path" int accessor that doesn't check for overflow and returns the int truncated to the machine word size, ie mp_int_t. Use mp_obj_int_get_truncated to fix struct.pack when packing maximum word sized values. Addresses issues #779 and #998.
* Use MP_DEFINE_CONST_DICT macro to define module dicts.Damien George2014-11-29
| | | | | This is just a clean-up of the code. Generated code is exactly the same.
* Implement kwargs for builtin open() and _io.FileIOstijn2014-10-21
| | | | | | | This makes open() and _io.FileIO() more CPython compliant. The mode kwarg is fully iplemented. The encoding kwarg is allowed but not implemented; mainly to allow the tests to specify encoding for CPython, see #874
* unix, stmhal: Implement file.readinto() method.Paul Sokolovsky2014-10-18
| | | | | | Also, usocket.readinto(). Known issue is that .readinto() should be available only for binary files, but micropython uses single method table for both binary and text files.
* unix: Rename "microsocket" module to "usocket".Paul Sokolovsky2014-10-09
| | | | | | Per new conventions, we'd like to consistently use "u*" naming conventions for modules which don't offer complete CPython compatibility, while offer subset or similar API.
* unix: Don't use -Wno-error=cpp or #warning; fix strict alias warning.Damien George2014-09-06
| | | | | | | | | | For the sake of older versions of gcc (and other compilers), don't use the #warning CPP directive, nor the -Wno-error=cpp option. Also, fix a strict alias warning in modffi.c for older compilers, and add a test for ffi module. Addresses issue #847.
* Change some parts of the core API to use mp_uint_t instead of uint/int.Damien George2014-08-30
| | | | Addressing issue #50, still some way to go yet.
* modsocket: .recv() returns bytes object.Paul Sokolovsky2014-08-10
|
* py: Make MP_OBJ_NEW_SMALL_INT cast arg to mp_int_t itself.Damien George2014-07-31
| | | | Addresses issue #724.
* py: Change stream protocol API: fns return uint; is_text for text.Damien George2014-07-27
|
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* modsocket: Fix uClibc detection.Paul Sokolovsky2014-06-24
|
* modsocket: Workaround uClibc issue with numeric port for getaddrinfo().Paul Sokolovsky2014-06-22
| | | | | It sucks to workaround this on uPy side, but upgrading not upgradable embedded systems sucks even more.
* modsocket: Add call to freeaddrinfo().Paul Sokolovsky2014-06-22
|
* Prefix ARRAY_SIZE with micropython prefix MP_Emmanuel Blot2014-06-19
|
* - FreeBSD provides alloca() via stdlib.h, in contrast to Linux and WindowsMarcus von Appen2014-06-07
| | | | - Move the includes for alloca() intp mpconfigport.h
* modsocket: Add some comments on intended usage/API design of module.Paul Sokolovsky2014-05-31
|
* modsocket: Remove stale ifdef.Paul Sokolovsky2014-05-31
|
* Change const byte* to const char* where sensible.Damien George2014-05-25
| | | | | This removes need for some casts (at least, more than it adds need for new casts!).
* modsocket: 64-bit cleanness.Paul Sokolovsky2014-05-24
|
* unix modsocket: Make .makefile() method more compliant.Paul Sokolovsky2014-05-24
| | | | | .makefile() should allow to specify which stream time to create - byte or text.
* Merge pull request #607 from Anton-2/osx-clangDamien George2014-05-21
|\ | | | | Allow compilation of unix port under clang on OS X
| * Fix some unused variables, and silence a clang warning about initialization ↵Antonin ENFRUN2014-05-12
| | | | | | | | override in vmentrytable.h
* | py, unix: Add copyright for modules I worked closely on.Paul Sokolovsky2014-05-13
|/
* unix modsocket: Add comments re: recv() vs read(), etc. semantics.Paul Sokolovsky2014-05-07
|
* Add license header to (almost) all files.Damien George2014-05-03
| | | | | | | Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.