Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Experimental] WIP newtype redefinition of ProtocolNumber #469

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Commits on Jul 17, 2020

  1. WIP newtype redefinition of ProtocolNumber

    redefines ProtocolNumber as newtype around CInt (formerly type alias for CInt)
    that re-derives all instance methods for CInt that are defined in Foreign.C.Types
    
    defines and exports pattern synonyms for commonly used protocol-number constants (defined in "netinet/in.h")
    (IPPROTO_(IP|IPV4|IPV6|TCP|UDP|ICMP|ICMPV6|RAW)) as well as UnsupportedProtocol and GeneralProtocol patterns
    
    refactored function definitions previously relying on (ProtocolNumber ~ CInt) to use unwrapper function
    
    implements bijective read/show instances for ProtocolNumber whose default behavior is to directly read and show integer values with no constructor syntax
    archaephyrryx committed Jul 17, 2020
    Configuration menu
    Copy the full SHA
    585e701 View commit details
    Browse the repository at this point in the history
  2. FIX doctest and IP-specific documentation

    Unbreaks doctest by substituting new `show` value of defaultProtocol
    where it appears in haddock examples
    
    Clarifies behavior of show for ProtocolNumber to highlight that
    pattern synonym names and their corresponding show values are based
    on assumption of IP protocol families even though the type itself
    remains general over all protocol families.
    archaephyrryx committed Jul 17, 2020
    Configuration menu
    Copy the full SHA
    9736cbd View commit details
    Browse the repository at this point in the history

Commits on Jul 18, 2020

  1. refactors definitions of protocolnumber synonyms

    Redefines ProtocolNumber synonyms in terms of canonical "magic" numbers
    from IANA reference (https://www.iana.org/assignments/protocol-numbers)
    rather than CPP-constants from C header file.
    
    Removes UnsupportedProtocol as all definitions are unconditional instead
    of relying on C header-file macro definitions; redefines test case to
    ensure that the value 'ProtocolNumber (-1)' is represented shown as "-1"
    rather than "UnsupportedProtocol"
    
    Renames IPPROTO_IP (dummy for '0') as DefaultProtocol, both as a pattern
    synonym and in read/show boilerplate bijection (as well as in haddock
    examples and tests/Network/SocketSpec.hs)
    archaephyrryx committed Jul 18, 2020
    Configuration menu
    Copy the full SHA
    d988efd View commit details
    Browse the repository at this point in the history