Skip to content

Commit

Permalink
Express in_addr_t and sin_port_t as byte arrays.
Browse files Browse the repository at this point in the history
* Since they are not always in native format.
  • Loading branch information
postmodern committed Jun 5, 2009
1 parent 430222b commit d5f6dea
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/pcap_ffi/in_addr.rb
Expand Up @@ -6,7 +6,7 @@ module FFI
module PCap
class InAddr < FFI::Struct

layout :s_addr, :in_addr_t
layout :s_addr, [NativeType::UINT8, 4]

end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/pcap_ffi/sock_addr_in.rb
Expand Up @@ -8,7 +8,7 @@ module PCap
class SockAddrIn < FFI::Struct

layout :sin_family, :sa_family_t,
:sin_port, :in_port_t,
:sin_port, [NativeType::UINT8, 2]
:sin_addr, InAddr,
:sin_zero, [:char, ]

Expand Down
2 changes: 0 additions & 2 deletions lib/pcap_ffi/typedefs.rb
Expand Up @@ -4,8 +4,6 @@ module FFI
alias_type :long, :time_t
alias_type :long, :suseconds_t
alias_type :ushort, :sa_family_t
alias_type :uint16, :in_port_t
alias_type :uint32, :in_addr_t
alias_type :int, :bpf_int32
alias_type :uint, :bpf_uint32
end

0 comments on commit d5f6dea

Please sign in to comment.