Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Dec 25, 2010

  1. Michael Santos

    Add sendto/2,3

    Add versions of sendto with defaults. sendto/2 corresponds to write and
    sendto/3 corresponds to send.
    authored

Dec 21, 2010

  1. Michael Santos

    Socket args can be either atoms or integers

    Personally, I prefer the integer macros. Todo: use integer macros when
    mapping atom name -> integer.
    authored
  2. Michael Santos

    Remove fd transfer functions from export

    Remove the functions used for transferring the socket fd between process
    from the export list. TODO: create wrappers for libancillary
    authored
  3. Michael Santos

    Return socket address from accept/2

    authored

Dec 17, 2010

  1. Michael Santos

    Remove close/2; add listen/1

    Remove close/2 which removed the Unix socket. Handle the socket deletion
    in Erlang. Add listen/1 which uses a default backlog.
    authored
  2. Michael Santos

    recvfrom/4: return socket address

    Add recvfrom/4 to return the socket address of the packet. recvfrom/4
    takes 2 new args: flags and the size of the socket structure which is
    allocated by the NIF. If the size is not large enough, the socket address
    will be silently truncated.
    authored

Dec 15, 2010

  1. Michael Santos

    Communicate with Unix sockets

    Break out socket primitives (socket, listen, accept, ...) to allow Erlang
    to create and access Unix sockets. Any type of unprivileged socket can
    be created without spawning the setuid helper.
    
    Warning: because listen/2 is now a wrapper around the listen(2), the
    procket:listen/1,2 has been renamed to procket:open/1,2.
    authored

Dec 10, 2010

  1. Michael Santos

    Clean up local socket temp directory

    If a temporary directory was created to hold the Unix socket, delete it
    after the privileged socket has been sent to Erlang.
    authored

Oct 30, 2010

  1. Michael Santos

    Fix fd leak

    The Unix socket file descriptor was leaked whenever there was an error.
    authored

Oct 06, 2010

  1. Add interface name sanitation

    authored
  2. Added option to bind a socket to a specific interface

    authored

Jun 26, 2010

  1. Michael Santos

    Close any file descriptor

    Re-use procket:close/2 to close any file descriptor. Consequently,
    reverse the arguments to close/2, to take the fd first.
    authored

Jun 24, 2010

  1. Michael Santos

    Add an NIF setsockopt for promiscous mode

    Add an interface to setsockopt(). procket:setsockopt/4 can be used for
    putting the interface into promiscous mode.  Add packet:promiscuous/2
    convenience function to do that:
    
    packet:promiscuous(Socket, Ifindex)
    authored

Jun 13, 2010

  1. Michael Santos

    Add an NIF interface to ioctl()

    Add an Erlang interface to ioctl() using an NIF. For example, to retrieve
    the interface index for the "eth0" interface to use for sending out
    raw packets:
    
    -define(SIOCGIFINDEX, 16#8933).
    {ok, <<_Ifname:16/bytes, Ifr:8, _/binary>>} = procket:ioctl(S,
            ?SIOCGIFINDEX,
            <<"eth0", 0:224>>).
    
    The value "Ifr" will contain the index that can be used to set the
    sll_ifindex member of struct sockaddr_ll.
    authored
  2. Michael Santos

    Add sendto/4 and bind/2

    sendto/4 takes as arguments:
    * the socket descriptor
    * the buffer to be sent
    * flags
    * a binary representing a struct sockaddr_*
    
    For example, to send an ICMP echo to 192.168.100.1, assuming the variable
    "Packet" holds a valid ICMP packet:
    
    ok = procket:sendto(S, Packet, 0,
        <<
            2:16/native,                    % sin_family: PF_INET
            0:16,                           % sin_port
            192:8, 168:8, 100:8, 1:8,       % sin_addr
            0:64                            % sin_zero
        >>
    ).
    
    Similarly, bind/2 takes:
    * the socket descriptor
    * a binary representing a struct sockaddr_*
    authored

May 29, 2010

  1. Michael Santos

    Add NIF versions of recvfrom/sendto

    sendto is untested and disabled. Make sockets non-blocking for NIF
    sendto/recvfrom. Cache atoms and clean up corresponding error functions.
    authored

May 26, 2010

  1. Michael Santos

    Type conversion is wardsback

    authored
  2. Michael Santos

    Allow arbitrary socket family, type and protocol

    Simplify the procket external command by allowing the user to set
    any protocol, type and family for the socket.
    authored

Mar 09, 2010

  1. Michael Santos

    Dynamically create path to procket executable too.

    The path to the procket executable can still be set using {progname, ...}.
    By default, figure out the path relative to the module in ebin and run
    it using sudo.
    authored
  2. Michael Santos

    Dynamically create path to NIF relative to module.

    Assumes the lib is in the priv directory.
    authored

Mar 08, 2010

  1. Michael Santos

    Changes for the R13B04 nif interface.

    Also an excuse to do some clean up.
    authored

Jan 11, 2010

  1. Michael Santos

    Make the NIF stateless!

    Need to explicitly pass in socket info to the procket NIF, rather than it
    tracking the data internally. This should make it much safer and reliable.
    
    Changes to the interface:
    
    open/2 -> open/1 : vestigal protocol arg removed, stick to streams. Erlang module changed to match (along with the bizarre passing in of the port as a protocol, who did that? o_O)
    
    Returns the socket descriptor listening on the Unix socket: {ok, FD}
    
    poll/0 -> poll/1 : takes the socket descriptor
    
    close/0 -> close/2 : close(SocketPath, SocketDescriptor), closes the socket descriptor and deletes the socket path.
    authored

Jan 09, 2010

  1. Michael Santos

    Interface for requesting privileged sockets in Erlang.

    authored
Something went wrong with that request. Please try again.