ffi-libc 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog.md CHANGED
@@ -1,4 +1,15 @@
1
- ### 0.1.0 / 2010-05-19
1
+ ### 0.0.2 / 2010-05-21
2
+
3
+ * Removed a duplicate typedef of the `size_t` type.
4
+ * Added the Structs:
5
+ * {FFI::LibC::InAddr}.
6
+ * {FFI::LibC::In6Addr}.
7
+ * {FFI::LibC::SockAddr}.
8
+ * {FFI::LibC::SockAddrDL}.
9
+ * {FFI::LibC::SockAddrIn}.
10
+ * {FFI::LibC::SockAddrIn6}.
11
+
12
+ ### 0.0.1 / 2010-05-19
2
13
 
3
14
  * Initial release.
4
15
  * Added the Structs:
data/README.md CHANGED
@@ -13,11 +13,9 @@ Useful Ruby FFI bindings for `libc`.
13
13
  * Provides common Structs used in `libc`.
14
14
  * Binds to common functions and global variables in `libc`.
15
15
 
16
- ## Examples
17
-
18
16
  ## Requirements
19
17
 
20
- * [ffi](http://github.com/ffi/ffi) >= 0.6.0
18
+ * [ffi](http://github.com/ffi/ffi) ~> 0.6.0
21
19
 
22
20
  ## Install
23
21
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/ffi-libc.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ffi-libc}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Postmodern"]
12
- s.date = %q{2010-05-19}
12
+ s.date = %q{2010-05-21}
13
13
  s.description = %q{Useful Ruby FFI bindings for libc.}
14
14
  s.email = %q{postmodern.mod3@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -29,7 +29,15 @@ Gem::Specification.new do |s|
29
29
  "VERSION",
30
30
  "ffi-libc.gemspec",
31
31
  "lib/ffi/libc.rb",
32
+ "lib/ffi/libc/af.rb",
33
+ "lib/ffi/libc/in6_addr.rb",
34
+ "lib/ffi/libc/in_addr.rb",
32
35
  "lib/ffi/libc/libc.rb",
36
+ "lib/ffi/libc/sock_addr.rb",
37
+ "lib/ffi/libc/sock_addr_dl.rb",
38
+ "lib/ffi/libc/sock_addr_family.rb",
39
+ "lib/ffi/libc/sock_addr_in.rb",
40
+ "lib/ffi/libc/sock_addr_in6.rb",
33
41
  "lib/ffi/libc/timeval.rb",
34
42
  "lib/ffi/libc/timezone.rb",
35
43
  "lib/ffi/libc/types.rb"
@@ -0,0 +1,23 @@
1
+ require 'socket'
2
+
3
+ module FFI
4
+ module LibC
5
+ #
6
+ # Contains `AF_*` constants culled from Ruby's ::Socket
7
+ #
8
+ module AF
9
+ APPLETALK = 5
10
+ AX25 = 3
11
+ INET = 2
12
+ INET6 = 10
13
+ IPX = 4
14
+ ISDN = 34
15
+ LOCAL = 1
16
+ MAX = 36
17
+ ROUTE = 16
18
+ SNA = 22
19
+ UNIX = 1
20
+ UNSPEC = 0
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,12 @@
1
+ module FFI
2
+ module LibC
3
+ #
4
+ # Used to represent an IPv6 address in a `sock_addr_in6` structure
5
+ #
6
+ class In6Addr < ::FFI::Struct
7
+
8
+ layout :s6_addr, [:uint8, 16]
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ require 'ffi/libc/types'
2
+
3
+ module FFI
4
+ module LibC
5
+ #
6
+ # Used to represent a 32-bit IPv4 address in a `sock_addr_in` structure
7
+ #
8
+ class InAddr < ::FFI::Struct
9
+
10
+ layout :in_addr, :in_addr_t
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,17 @@
1
+ require 'ffi/libc/types'
2
+ require 'ffi/libc/sock_addr_family'
3
+
4
+ module FFI
5
+ module LibC
6
+ #
7
+ # The generic `sock_addr` structure.
8
+ #
9
+ class SockAddr < SockAddrFamily
10
+
11
+ layout :len, :uint8,
12
+ :family, :sa_family_t,
13
+ :data, :char
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ require 'ffi/libc/types'
2
+ require 'ffi/libc/sock_addr_family'
3
+
4
+ module FFI
5
+ module LibC
6
+ #
7
+ # The data-link socket address
8
+ #
9
+ class SockAddrDL < SockAddrFamily
10
+
11
+ layout :len, :uint8,
12
+ :family, :sa_family_t,
13
+ :sdl_index, :uint16,
14
+ :dltype, :uint8,
15
+ :nlen, :uint8,
16
+ :alen, :uint8,
17
+ :slen, :uint8,
18
+ :_data, :char
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,12 @@
1
+ require 'ffi/libc/af'
2
+
3
+ module FFI
4
+ module LibC
5
+ #
6
+ # Common abstract superclass for all sockaddr struct classes
7
+ #
8
+ class SockAddrFamily < ::FFI::Struct
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,19 @@
1
+ require 'ffi/libc/types'
2
+ require 'ffi/libc/sock_addr_family'
3
+
4
+ module FFI
5
+ module LibC
6
+ #
7
+ # sockaddr inet, always good to have around
8
+ #
9
+ class SockAddrIn < SockAddrFamily
10
+
11
+ layout :len, :uint8,
12
+ :family, :sa_family_t,
13
+ :port, :in_port_t,
14
+ :addr, :in_addr_t,
15
+ :_sa_zero, [:uint8, 8]
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ require 'ffi/libc/types'
2
+ require 'ffi/libc/in6_addr'
3
+
4
+ module FFI
5
+ module LibC
6
+ #
7
+ # IPv6 socket address
8
+ #
9
+ class SockAddrIn6 < SockAddrFamily
10
+
11
+ layout :len, :uint8,
12
+ :family, :sa_family_t,
13
+ :port, :in_port_t,
14
+ :flowinfo, :uint32,
15
+ :addr, In6Addr
16
+
17
+ end
18
+ end
19
+ end
@@ -4,11 +4,8 @@ module FFI
4
4
  module LibC
5
5
  extend FFI::Library
6
6
 
7
- typedef :uint, :size_t
8
- typedef :int, :ssize_t
9
- typedef :uint, :off_t
10
- typedef :ulong, :time_t
11
- typedef :long, :suseconds_t
12
7
  typedef :pointer, :FILE
8
+ typedef :uint32, :in_addr_t
9
+ typedef :uint16, :in_port_t
13
10
  end
14
11
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-libc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Postmodern
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-19 00:00:00 -07:00
18
+ date: 2010-05-21 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -120,7 +120,15 @@ files:
120
120
  - VERSION
121
121
  - ffi-libc.gemspec
122
122
  - lib/ffi/libc.rb
123
+ - lib/ffi/libc/af.rb
124
+ - lib/ffi/libc/in6_addr.rb
125
+ - lib/ffi/libc/in_addr.rb
123
126
  - lib/ffi/libc/libc.rb
127
+ - lib/ffi/libc/sock_addr.rb
128
+ - lib/ffi/libc/sock_addr_dl.rb
129
+ - lib/ffi/libc/sock_addr_family.rb
130
+ - lib/ffi/libc/sock_addr_in.rb
131
+ - lib/ffi/libc/sock_addr_in6.rb
124
132
  - lib/ffi/libc/timeval.rb
125
133
  - lib/ffi/libc/timezone.rb
126
134
  - lib/ffi/libc/types.rb