Browse Source

Rename "Client" to "Channel"

Tim Burks 9 years ago
parent
commit
01c73a9925

+ 4 - 4
Examples/Datastore/Datastore/DatastoreViewController.swift

@@ -41,7 +41,7 @@ class DatastoreViewController : NSViewController, NSTextFieldDelegate {
   @IBOutlet weak var outputField: NSTextField!
 
   private var fileDescriptorSet : FileDescriptorSet
-  private var client: Client?
+  private var channel: Channel?
   private var call: Call?
 
   private var webViewWindowController : WebViewWindowController!
@@ -82,7 +82,7 @@ class DatastoreViewController : NSViewController, NSTextFieldDelegate {
   }
 
   func createClient(address: String, host: String) {
-    client = Client(address:address, certificates:nil, host:nil)
+    channel = Channel(address:address, certificates:nil, host:nil)
   }
 
   func callServer(address:String) {
@@ -109,10 +109,10 @@ class DatastoreViewController : NSViewController, NSTextFieldDelegate {
       check?.display()
 
       createClient(address:address, host:requestHost)
-      guard let client = client else {
+      guard let channel = channel else {
         return
       }
-      call = client.makeCall("/google.datastore.v1.Datastore/RunQuery")
+      call = channel.makeCall("/google.datastore.v1.Datastore/RunQuery")
       guard let call = call else {
         return
       }

+ 12 - 12
Examples/Echo/Swift/Echo/EchoViewController.swift

@@ -42,7 +42,7 @@ class EchoViewController : NSViewController, NSTextFieldDelegate {
   @IBOutlet weak var TLSButton: NSButton!
 
   private var fileDescriptorSet : FileDescriptorSet
-  private var client: Client?
+  private var channel: Channel?
   private var call: Call?
   private var nowStreaming = false
 
@@ -90,16 +90,16 @@ class EchoViewController : NSViewController, NSTextFieldDelegate {
     }
   }
 
-  func prepareClient(address: String, host: String) {
+  func prepareChannel(address: String, host: String) {
     if (TLSButton.intValue == 0) {
-      client = Client(address:address)
+      channel = Channel(address:address)
     } else {
       let certificateURL = Bundle.main.url(forResource: "ssl", withExtension: "crt")!
       let certificates = try! String(contentsOf: certificateURL)
-      client = Client(address:address, certificates:certificates, host:host)
+      channel = Channel(address:address, certificates:certificates, host:host)
     }
-    if let client = client {
-      client.host = host
+    if let channel = channel {
+      channel.host = host
     }
   }
 
@@ -112,11 +112,11 @@ class EchoViewController : NSViewController, NSTextFieldDelegate {
       if let requestMessage = self.fileDescriptorSet.makeMessage("EchoRequest") {
         requestMessage.addField("text", value:self.messageField.stringValue)
         let requestMessageData = requestMessage.data()
-        prepareClient(address:address, host:host)
-        guard let client = client else {
+        prepareChannel(address:address, host:host)
+        guard let channel = channel else {
           return
         }
-        call = client.makeCall("/echo.Echo/Get")
+        call = channel.makeCall("/echo.Echo/Get")
         guard let call = call else {
           return
         }
@@ -143,11 +143,11 @@ class EchoViewController : NSViewController, NSTextFieldDelegate {
     else {
       // STREAMING
       if (!nowStreaming) {
-        prepareClient(address:address, host:host)
-        guard let client = client else {
+        prepareChannel(address:address, host:host)
+        guard let channel = channel else {
           return
         }
-        call = client.makeCall("/echo.Echo/Update")
+        call = channel.makeCall("/echo.Echo/Update")
         guard let call = call else {
           return
         }

+ 5 - 5
Examples/Sessions/Sessions/Document.swift

@@ -64,7 +64,7 @@ class Document: NSDocument {
   @IBOutlet var textView: NSTextView!
   // http://stackoverflow.com/questions/24062437/cannot-form-weak-reference-to-instance-of-class-nstextview
 
-  var client : Client!
+  var channel : Channel!
   var server : Server!
   var running: Bool // all accesses to this should be synchronized
 
@@ -141,7 +141,7 @@ class Document: NSDocument {
   }
 
   func stop() {
-    if (self.client != nil) {
+    if (self.channel != nil) {
       setIsRunning(false) // stops client
     }
     if (self.server != nil) {
@@ -154,8 +154,8 @@ class Document: NSDocument {
       self.log("Client Starting")
       self.log("GRPC version " + gRPC.version())
 
-      self.client = gRPC.Client(address:address)
-      self.client.host = "foo.test.google.fr"
+      self.channel = gRPC.Channel(address:address)
+      self.channel.host = "foo.test.google.fr"
       let messageData = "hello, server!".data(using: .utf8)
 
       let steps = 10
@@ -165,7 +165,7 @@ class Document: NSDocument {
           break
         }
         let method = (i < steps) ? "/hello" : "/quit"
-        let call = self.client.makeCall(method)
+        let call = self.channel.makeCall(method)
 
         let metadata = Metadata([["x": "xylophone"],
                                  ["y": "yu"],

+ 16 - 16
Packages/gRPC/Sources/Client.swift → Examples/Speech/Channel.swift

@@ -35,13 +35,13 @@
 #endif
 import Foundation
 
-/// A gRPC Client
-public class Client {
+/// A gRPC Channel
+public class Channel {
 
   /// Pointer to underlying C representation
-  private var underlyingClient: UnsafeMutableRawPointer
+  private var underlyingChannel: UnsafeMutableRawPointer
 
-  /// Completion queue for client call operations
+  /// Completion queue for channel call operations
   private var completionQueue: CompletionQueue
 
   /// Timeout for new calls
@@ -51,38 +51,38 @@ public class Client {
   public var host: String
 
 
-  /// Initializes a gRPC client
+  /// Initializes a gRPC channel
   ///
   /// - Parameter address: the address of the server to be called
   public init(address: String) {
     self.host = address
-    underlyingClient = cgrpc_client_create(address)
-    completionQueue = CompletionQueue(underlyingCompletionQueue:cgrpc_client_completion_queue(underlyingClient))
+    underlyingChannel = cgrpc_channel_create(address)
+    completionQueue = CompletionQueue(underlyingCompletionQueue:cgrpc_channel_completion_queue(underlyingChannel))
     completionQueue.name = "Client" // only for debugging
-    self.completionQueue.run() // start a loop that watches the client's completion queue
+    self.completionQueue.run() // start a loop that watches the channel's completion queue
   }
 
-  /// Initializes a gRPC client
+  /// Initializes a gRPC channel
   ///
   /// - Parameter address: the address of the server to be called
   public init(address: String, certificates: String?, host: String?) {
     self.host = address
     if certificates == nil {
-      let bundle = Bundle(for: Client.self)
+      let bundle = Bundle(for: Channel.self)
       let url = bundle.url(forResource: "roots", withExtension: "pem")!
       let data = try! Data(contentsOf: url)
       let s = String(data: data, encoding: .ascii)
-      underlyingClient = cgrpc_client_create_secure(address, s, host)
+      underlyingChannel = cgrpc_channel_create_secure(address, s, host)
     } else {
-      underlyingClient = cgrpc_client_create_secure(address, certificates, host)
+      underlyingChannel = cgrpc_channel_create_secure(address, certificates, host)
     }
-    completionQueue = CompletionQueue(underlyingCompletionQueue:cgrpc_client_completion_queue(underlyingClient))
+    completionQueue = CompletionQueue(underlyingCompletionQueue:cgrpc_channel_completion_queue(underlyingChannel))
     completionQueue.name = "Client" // only for debugging
-    self.completionQueue.run() // start a loop that watches the client's completion queue
+    self.completionQueue.run() // start a loop that watches the channel's completion queue
   }
 
   deinit {
-    cgrpc_client_destroy(underlyingClient)
+    cgrpc_channel_destroy(underlyingChannel)
   }
 
   /// Constructs a Call object to make a gRPC API call
@@ -93,7 +93,7 @@ public class Client {
   /// - Returns: a Call object that can be used to perform the request
   public func makeCall(_ method:String, host:String="") -> Call {
     let host = (host == "") ? self.host : host
-    let underlyingCall = cgrpc_client_create_call(underlyingClient, method, host, timeout)!
+    let underlyingCall = cgrpc_channel_create_call(underlyingChannel, method, host, timeout)!
     return Call(underlyingCall:underlyingCall, owned:true, completionQueue:self.completionQueue)
   }
 }

+ 8 - 8
Examples/Speech/Speech.xcodeproj/project.pbxproj

@@ -8,6 +8,8 @@
 
 /* Begin PBXBuildFile section */
 		2C450CC6320CA9890051ABAF /* Pods_Speech.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0B7F558BD8BC89862C8C277 /* Pods_Speech.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
+		D30DACE61DB5DE2C00886B20 /* channel.c in Sources */ = {isa = PBXBuildFile; fileRef = D30DACE51DB5DE2C00886B20 /* channel.c */; };
+		D30DACE81DB5DE4800886B20 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30DACE71DB5DE4800886B20 /* Channel.swift */; };
 		D31E0EB81D778A56006A50AB /* SpeechRecognitionService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D31E0EB71D778A56006A50AB /* SpeechRecognitionService.swift */; };
 		D31E0EBA1D77AA2F006A50AB /* AudioController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D31E0EB91D77AA2F006A50AB /* AudioController.swift */; };
 		D31E0EE91D78C679006A50AB /* grpc.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D31E0EE71D78C679006A50AB /* grpc.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
@@ -27,7 +29,6 @@
 		D33465B21D82985700C8D159 /* WireType.swift in Sources */ = {isa = PBXBuildFile; fileRef = D33465A51D82985700C8D159 /* WireType.swift */; };
 		D33465C21D82987700C8D159 /* byte_buffer.c in Sources */ = {isa = PBXBuildFile; fileRef = D33465B41D82987700C8D159 /* byte_buffer.c */; };
 		D33465C31D82987700C8D159 /* call.c in Sources */ = {isa = PBXBuildFile; fileRef = D33465B51D82987700C8D159 /* call.c */; };
-		D33465C41D82987700C8D159 /* client.c in Sources */ = {isa = PBXBuildFile; fileRef = D33465B71D82987700C8D159 /* client.c */; };
 		D33465C51D82987700C8D159 /* completion_queue.c in Sources */ = {isa = PBXBuildFile; fileRef = D33465B81D82987700C8D159 /* completion_queue.c */; };
 		D33465C61D82987700C8D159 /* event.c in Sources */ = {isa = PBXBuildFile; fileRef = D33465B91D82987700C8D159 /* event.c */; };
 		D33465C71D82987700C8D159 /* handler.c in Sources */ = {isa = PBXBuildFile; fileRef = D33465BA1D82987700C8D159 /* handler.c */; };
@@ -39,7 +40,6 @@
 		D33465CD1D82987700C8D159 /* server.c in Sources */ = {isa = PBXBuildFile; fileRef = D33465C11D82987700C8D159 /* server.c */; };
 		D33465DB1D82989900C8D159 /* ByteBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D33465CF1D82989900C8D159 /* ByteBuffer.swift */; };
 		D33465DC1D82989900C8D159 /* Call.swift in Sources */ = {isa = PBXBuildFile; fileRef = D33465D01D82989900C8D159 /* Call.swift */; };
-		D33465DE1D82989900C8D159 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = D33465D21D82989900C8D159 /* Client.swift */; };
 		D33465DF1D82989900C8D159 /* CompletionQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D33465D31D82989900C8D159 /* CompletionQueue.swift */; };
 		D33465E01D82989900C8D159 /* gRPC.swift in Sources */ = {isa = PBXBuildFile; fileRef = D33465D41D82989900C8D159 /* gRPC.swift */; };
 		D33465E11D82989900C8D159 /* Handler.swift in Sources */ = {isa = PBXBuildFile; fileRef = D33465D51D82989900C8D159 /* Handler.swift */; };
@@ -63,6 +63,8 @@
 		6C682F8DD9C94E41979FE816 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
 		C0B7F558BD8BC89862C8C277 /* Pods_Speech.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Speech.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		C2D2368DBC8898A52FE6113B /* Pods-Speech.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Speech.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Speech/Pods-Speech.debug.xcconfig"; sourceTree = "<group>"; };
+		D30DACE51DB5DE2C00886B20 /* channel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = channel.c; sourceTree = "<group>"; };
+		D30DACE71DB5DE4800886B20 /* Channel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Channel.swift; sourceTree = "<group>"; };
 		D31E0EB71D778A56006A50AB /* SpeechRecognitionService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpeechRecognitionService.swift; sourceTree = "<group>"; };
 		D31E0EB91D77AA2F006A50AB /* AudioController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AudioController.swift; sourceTree = "<group>"; };
 		D31E0EE71D78C679006A50AB /* grpc.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = grpc.framework; path = "../../../../../../Library/Developer/Xcode/DerivedData/Speech-erhyocopsowxtieeafxbpmpeffrg/Build/Products/Debug-iphonesimulator/gRPC-Core/grpc.framework"; sourceTree = "<group>"; };
@@ -83,7 +85,6 @@
 		D33465B41D82987700C8D159 /* byte_buffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = byte_buffer.c; path = ../../Packages/CgRPC/Sources/byte_buffer.c; sourceTree = "<group>"; };
 		D33465B51D82987700C8D159 /* call.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = call.c; path = ../../Packages/CgRPC/Sources/call.c; sourceTree = "<group>"; };
 		D33465B61D82987700C8D159 /* cgrpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cgrpc.h; path = ../../Packages/CgRPC/Sources/cgrpc.h; sourceTree = "<group>"; };
-		D33465B71D82987700C8D159 /* client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = client.c; path = ../../Packages/CgRPC/Sources/client.c; sourceTree = "<group>"; };
 		D33465B81D82987700C8D159 /* completion_queue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = completion_queue.c; path = ../../Packages/CgRPC/Sources/completion_queue.c; sourceTree = "<group>"; };
 		D33465B91D82987700C8D159 /* event.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = event.c; path = ../../Packages/CgRPC/Sources/event.c; sourceTree = "<group>"; };
 		D33465BA1D82987700C8D159 /* handler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = handler.c; path = ../../Packages/CgRPC/Sources/handler.c; sourceTree = "<group>"; };
@@ -96,7 +97,6 @@
 		D33465C11D82987700C8D159 /* server.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = server.c; path = ../../Packages/CgRPC/Sources/server.c; sourceTree = "<group>"; };
 		D33465CF1D82989900C8D159 /* ByteBuffer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ByteBuffer.swift; path = ../../Packages/gRPC/Sources/ByteBuffer.swift; sourceTree = "<group>"; };
 		D33465D01D82989900C8D159 /* Call.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Call.swift; path = ../../Packages/gRPC/Sources/Call.swift; sourceTree = "<group>"; };
-		D33465D21D82989900C8D159 /* Client.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Client.swift; path = ../../Packages/gRPC/Sources/Client.swift; sourceTree = "<group>"; };
 		D33465D31D82989900C8D159 /* CompletionQueue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CompletionQueue.swift; path = ../../Packages/gRPC/Sources/CompletionQueue.swift; sourceTree = "<group>"; };
 		D33465D41D82989900C8D159 /* gRPC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = gRPC.swift; path = ../../Packages/gRPC/Sources/gRPC.swift; sourceTree = "<group>"; };
 		D33465D51D82989900C8D159 /* Handler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Handler.swift; path = ../../Packages/gRPC/Sources/Handler.swift; sourceTree = "<group>"; };
@@ -169,7 +169,7 @@
 				D33465B41D82987700C8D159 /* byte_buffer.c */,
 				D33465B51D82987700C8D159 /* call.c */,
 				D33465B61D82987700C8D159 /* cgrpc.h */,
-				D33465B71D82987700C8D159 /* client.c */,
+				D30DACE51DB5DE2C00886B20 /* channel.c */,
 				D33465B81D82987700C8D159 /* completion_queue.c */,
 				D33465B91D82987700C8D159 /* event.c */,
 				D33465BA1D82987700C8D159 /* handler.c */,
@@ -187,9 +187,9 @@
 		D33465E71D8298A200C8D159 /* gRPC/Sources */ = {
 			isa = PBXGroup;
 			children = (
+				D30DACE71DB5DE4800886B20 /* Channel.swift */,
 				D33465CF1D82989900C8D159 /* ByteBuffer.swift */,
 				D33465D01D82989900C8D159 /* Call.swift */,
-				D33465D21D82989900C8D159 /* Client.swift */,
 				D33465D31D82989900C8D159 /* CompletionQueue.swift */,
 				D33465D41D82989900C8D159 /* gRPC.swift */,
 				D33465D51D82989900C8D159 /* Handler.swift */,
@@ -387,6 +387,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				D33465E01D82989900C8D159 /* gRPC.swift in Sources */,
+				D30DACE81DB5DE4800886B20 /* Channel.swift in Sources */,
 				D33465A71D82985700C8D159 /* CodeBuilder.swift in Sources */,
 				D33465AD1D82985700C8D159 /* FileDescriptorSet.swift in Sources */,
 				D33465DC1D82989900C8D159 /* Call.swift in Sources */,
@@ -397,12 +398,12 @@
 				D31E0EBA1D77AA2F006A50AB /* AudioController.swift in Sources */,
 				D33465A61D82985700C8D159 /* _FileDescriptor.swift in Sources */,
 				D33465C51D82987700C8D159 /* completion_queue.c in Sources */,
+				D30DACE61DB5DE2C00886B20 /* channel.c in Sources */,
 				D33465AA1D82985700C8D159 /* FieldLabel.swift in Sources */,
 				D33465C81D82987700C8D159 /* internal.c in Sources */,
 				D33465E21D82989900C8D159 /* Metadata.swift in Sources */,
 				D33465A91D82985700C8D159 /* FieldDescriptor.swift in Sources */,
 				D33465C91D82987700C8D159 /* metadata.c in Sources */,
-				D33465C41D82987700C8D159 /* client.c in Sources */,
 				D33465DB1D82989900C8D159 /* ByteBuffer.swift in Sources */,
 				D33465B11D82985700C8D159 /* NSMutableData+Proto.swift in Sources */,
 				D31E0EB81D778A56006A50AB /* SpeechRecognitionService.swift in Sources */,
@@ -417,7 +418,6 @@
 				D33465E31D82989900C8D159 /* Mutex.swift in Sources */,
 				D3E34EA51D7757CC00EF755D /* ViewController.swift in Sources */,
 				D33465CC1D82987700C8D159 /* operations.c in Sources */,
-				D33465DE1D82989900C8D159 /* Client.swift in Sources */,
 				D33465A81D82985700C8D159 /* Field.swift in Sources */,
 				D33465C71D82987700C8D159 /* handler.c in Sources */,
 				D33465AF1D82985700C8D159 /* MessageDescriptor.swift in Sources */,

+ 3 - 3
Examples/Speech/Speech/SpeechRecognitionService.swift

@@ -25,14 +25,14 @@ class SpeechRecognitionService {
   private var nowStreaming = false
 
   var fileDescriptorSet : FileDescriptorSet
-  var client: Client
+  var channel: Channel
   var call: Call?
 
   static let sharedInstance = SpeechRecognitionService()
 
   private init() {
     fileDescriptorSet = FileDescriptorSet(filename: "speech.out")
-    client = Client(address:HOST, certificates: nil, host: nil)
+    channel = Channel(address:HOST, certificates: nil, host: nil)
   }
 
   func streamAudioData(_ audioData: NSData, completion: SpeechRecognitionCompletionHandler) {
@@ -41,7 +41,7 @@ class SpeechRecognitionService {
 
       if (!nowStreaming) {
         // if we aren't already streaming, set up a gRPC connection
-        call = client.makeCall("/google.cloud.speech.v1beta1.Speech/StreamingRecognize")
+        call = channel.makeCall("/google.cloud.speech.v1beta1.Speech/StreamingRecognize")
 
         if let call = call {
           let metadata = Metadata(["x-goog-api-key":API_KEY,

+ 30 - 30
Packages/CgRPC/Sources/client.c → Examples/Speech/channel.c

@@ -39,21 +39,21 @@
 #include <stdlib.h>
 #include <string.h>
 
-cgrpc_client *cgrpc_client_create(const char *address) {
-  cgrpc_client *c = (cgrpc_client *) malloc(sizeof (cgrpc_client));
-  // create the client
-  grpc_channel_args client_args;
-  client_args.num_args = 0;
-  c->client = grpc_insecure_channel_create(address, &client_args, NULL);
+cgrpc_channel *cgrpc_channel_create(const char *address) {
+  cgrpc_channel *c = (cgrpc_channel *) malloc(sizeof (cgrpc_channel));
+  // create the channel
+  grpc_channel_args channel_args;
+  channel_args.num_args = 0;
+  c->channel = grpc_insecure_channel_create(address, &channel_args, NULL);
   c->completion_queue = grpc_completion_queue_create(NULL);
   return c;
 }
 
-cgrpc_client *cgrpc_client_create_secure(const char *address,
-                                         const char *pem_root_certs,
-                                         const char *host) {
-  cgrpc_client *c = (cgrpc_client *) malloc(sizeof (cgrpc_client));
-  // create the client
+cgrpc_channel *cgrpc_channel_create_secure(const char *address,
+                                           const char *pem_root_certs,
+                                           const char *host) {
+  cgrpc_channel *c = (cgrpc_channel *) malloc(sizeof (cgrpc_channel));
+  // create the channel
 
   int argMax = 2;
   grpc_channel_args *channelArgs = gpr_malloc(sizeof(grpc_channel_args));
@@ -76,15 +76,15 @@ cgrpc_client *cgrpc_client_create_secure(const char *address,
   channelArgs->num_args = argCount;
 
   grpc_channel_credentials *creds = grpc_ssl_credentials_create(pem_root_certs, NULL, NULL);
-  c->client = grpc_secure_channel_create(creds, address, channelArgs, NULL);
+  c->channel = grpc_secure_channel_create(creds, address, channelArgs, NULL);
   c->completion_queue = grpc_completion_queue_create(NULL);
   return c;
 }
 
 
-void cgrpc_client_destroy(cgrpc_client *c) {
-  grpc_channel_destroy(c->client);
-  c->client = NULL;
+void cgrpc_channel_destroy(cgrpc_channel *c) {
+  grpc_channel_destroy(c->channel);
+  c->channel = NULL;
 
   grpc_completion_queue_shutdown(c->completion_queue);
   cgrpc_completion_queue_drain(c->completion_queue);
@@ -92,26 +92,26 @@ void cgrpc_client_destroy(cgrpc_client *c) {
   free(c);
 }
 
-cgrpc_call *cgrpc_client_create_call(cgrpc_client *client,
-                                     const char *method,
-                                     const char *host,
-                                     double timeout) {
+cgrpc_call *cgrpc_channel_create_call(cgrpc_channel *channel,
+                                      const char *method,
+                                      const char *host,
+                                      double timeout) {
   // create call
   gpr_timespec deadline = cgrpc_deadline_in_seconds_from_now(timeout);
-  grpc_call *client_call = grpc_channel_create_call(client->client,
-                                                    NULL,
-                                                    GRPC_PROPAGATE_DEFAULTS,
-                                                    client->completion_queue,
-                                                    method,
-                                                    host,
-                                                    deadline,
-                                                    NULL);
+  grpc_call *channel_call = grpc_channel_create_call(channel->channel,
+                                                     NULL,
+                                                     GRPC_PROPAGATE_DEFAULTS,
+                                                     channel->completion_queue,
+                                                     method,
+                                                     host,
+                                                     deadline,
+                                                     NULL);
   cgrpc_call *call = (cgrpc_call *) malloc(sizeof(cgrpc_call));
   memset(call, 0, sizeof(cgrpc_call));
-  call->call = client_call;
+  call->call = channel_call;
   return call;
 }
 
-cgrpc_completion_queue *cgrpc_client_completion_queue(cgrpc_client *client) {
-  return client->completion_queue;
+cgrpc_completion_queue *cgrpc_channel_completion_queue(cgrpc_channel *channel) {
+  return channel->completion_queue;
 }

+ 4 - 4
Examples/StickyNotes/StickyNotes/StickyNoteViewController.swift

@@ -38,7 +38,7 @@ class StickyNoteViewController : NSViewController, NSTextFieldDelegate {
   @IBOutlet weak var messageField: NSTextField!
   @IBOutlet weak var imageView: NSImageView!
 
-  var client: Client!
+  var channel: Channel!
 
   var enabled = false
 
@@ -78,9 +78,9 @@ class StickyNoteViewController : NSViewController, NSTextFieldDelegate {
                                         ["y":"yu"],
                                         ["z":"zither"]])
 
-        client = Client(address:address)
-        client.host = requestHost
-        let call = client.makeCall(requestMethod)
+        channel = Channel(address:address)
+        channel.host = requestHost
+        let call = channel.makeCall(requestMethod)
         try call.perform(message: requestMessage.data(),
                          metadata: requestMetadata,
                          completion:

+ 13 - 13
Packages/CgRPC/Sources/cgrpc.h

@@ -41,7 +41,7 @@
 // all domain types are opaque pointers
 typedef void cgrpc_byte_buffer;
 typedef void cgrpc_call;
-typedef void cgrpc_client;
+typedef void cgrpc_channel;
 typedef void cgrpc_completion_queue;
 typedef void cgrpc_handler;
 typedef void cgrpc_metadata;
@@ -126,18 +126,18 @@ void grpc_init();
 void grpc_shutdown();
 const char *grpc_version_string();
 
-// client support
-cgrpc_client *cgrpc_client_create(const char *address);
-cgrpc_client *cgrpc_client_create_secure(const char *address,
-                                         const char *pem_root_certs,
-                                         const char *host);
-
-void cgrpc_client_destroy(cgrpc_client *client);
-cgrpc_call *cgrpc_client_create_call(cgrpc_client *client,
-                                     const char *method,
-                                     const char *host,
-                                     double timeout);
-cgrpc_completion_queue *cgrpc_client_completion_queue(cgrpc_client *client);
+// channel support
+cgrpc_channel *cgrpc_channel_create(const char *address);
+cgrpc_channel *cgrpc_channel_create_secure(const char *address,
+                                           const char *pem_root_certs,
+                                           const char *host);
+
+void cgrpc_channel_destroy(cgrpc_channel *channel);
+cgrpc_call *cgrpc_channel_create_call(cgrpc_channel *channel,
+                                      const char *method,
+                                      const char *host,
+                                      double timeout);
+cgrpc_completion_queue *cgrpc_channel_completion_queue(cgrpc_channel *channel);
 
 // server support
 cgrpc_server *cgrpc_server_create(const char *address);

+ 117 - 0
Packages/CgRPC/Sources/channel.c

@@ -0,0 +1,117 @@
+/*
+ *
+ * Copyright 2016, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "internal.h"
+#include "cgrpc.h"
+#include <grpc/support/string_util.h>
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+cgrpc_channel *cgrpc_channel_create(const char *address) {
+  cgrpc_channel *c = (cgrpc_channel *) malloc(sizeof (cgrpc_channel));
+  // create the channel
+  grpc_channel_args channel_args;
+  channel_args.num_args = 0;
+  c->channel = grpc_insecure_channel_create(address, &channel_args, NULL);
+  c->completion_queue = grpc_completion_queue_create(NULL);
+  return c;
+}
+
+cgrpc_channel *cgrpc_channel_create_secure(const char *address,
+                                           const char *pem_root_certs,
+                                           const char *host) {
+  cgrpc_channel *c = (cgrpc_channel *) malloc(sizeof (cgrpc_channel));
+  // create the channel
+
+  int argMax = 2;
+  grpc_channel_args *channelArgs = gpr_malloc(sizeof(grpc_channel_args));
+  channelArgs->args = gpr_malloc(argMax * sizeof(grpc_arg));
+
+  int argCount = 1;
+  grpc_arg *arg = &channelArgs->args[0];
+  arg->type = GRPC_ARG_STRING;
+  arg->key = gpr_strdup("grpc.primary_user_agent");
+  arg->value.string = gpr_strdup("grpc-swift/0.0.1");
+
+  if (host) {
+    argCount++;
+    arg = &channelArgs->args[1];
+    arg->type = GRPC_ARG_STRING;
+    arg->key = gpr_strdup("grpc.ssl_target_name_override");
+    arg->value.string = gpr_strdup(host);
+  }
+
+  channelArgs->num_args = argCount;
+
+  grpc_channel_credentials *creds = grpc_ssl_credentials_create(pem_root_certs, NULL, NULL);
+  c->channel = grpc_secure_channel_create(creds, address, channelArgs, NULL);
+  c->completion_queue = grpc_completion_queue_create(NULL);
+  return c;
+}
+
+
+void cgrpc_channel_destroy(cgrpc_channel *c) {
+  grpc_channel_destroy(c->channel);
+  c->channel = NULL;
+
+  grpc_completion_queue_shutdown(c->completion_queue);
+  cgrpc_completion_queue_drain(c->completion_queue);
+  grpc_completion_queue_destroy(c->completion_queue);
+  free(c);
+}
+
+cgrpc_call *cgrpc_channel_create_call(cgrpc_channel *channel,
+                                      const char *method,
+                                      const char *host,
+                                      double timeout) {
+  // create call
+  gpr_timespec deadline = cgrpc_deadline_in_seconds_from_now(timeout);
+  grpc_call *channel_call = grpc_channel_create_call(channel->channel,
+                                                     NULL,
+                                                     GRPC_PROPAGATE_DEFAULTS,
+                                                     channel->completion_queue,
+                                                     method,
+                                                     host,
+                                                     deadline,
+                                                     NULL);
+  cgrpc_call *call = (cgrpc_call *) malloc(sizeof(cgrpc_call));
+  memset(call, 0, sizeof(cgrpc_call));
+  call->call = channel_call;
+  return call;
+}
+
+cgrpc_completion_queue *cgrpc_channel_completion_queue(cgrpc_channel *channel) {
+  return channel->completion_queue;
+}

+ 2 - 2
Packages/CgRPC/Sources/internal.h

@@ -48,9 +48,9 @@ typedef struct {
 } cgrpc_operations;
 
 typedef struct {
-  grpc_channel *client; // owned
+  grpc_channel *channel; // owned
   grpc_completion_queue *completion_queue; // owned
-} cgrpc_client;
+} cgrpc_channel;
 
 typedef struct {
   grpc_server *server; // owned

+ 99 - 0
Packages/gRPC/Sources/Channel.swift

@@ -0,0 +1,99 @@
+/*
+ *
+ * Copyright 2016, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#if SWIFT_PACKAGE
+  import CgRPC
+#endif
+import Foundation
+
+/// A gRPC Channel
+public class Channel {
+
+  /// Pointer to underlying C representation
+  private var underlyingChannel: UnsafeMutableRawPointer
+
+  /// Completion queue for channel call operations
+  private var completionQueue: CompletionQueue
+
+  /// Timeout for new calls
+  public var timeout: TimeInterval = 600.0
+
+  /// Default host to use for new calls
+  public var host: String
+
+
+  /// Initializes a gRPC channel
+  ///
+  /// - Parameter address: the address of the server to be called
+  public init(address: String) {
+    self.host = address
+    underlyingChannel = cgrpc_channel_create(address)
+    completionQueue = CompletionQueue(underlyingCompletionQueue:cgrpc_channel_completion_queue(underlyingChannel))
+    completionQueue.name = "Client" // only for debugging
+    self.completionQueue.run() // start a loop that watches the channel's completion queue
+  }
+
+  /// Initializes a gRPC channel
+  ///
+  /// - Parameter address: the address of the server to be called
+  public init(address: String, certificates: String?, host: String?) {
+    self.host = address
+    if certificates == nil {
+      let bundle = Bundle(for: Channel.self)
+      let url = bundle.url(forResource: "roots", withExtension: "pem")!
+      let data = try! Data(contentsOf: url)
+      let s = String(data: data, encoding: .ascii)
+      underlyingChannel = cgrpc_channel_create_secure(address, s, host)
+    } else {
+      underlyingChannel = cgrpc_channel_create_secure(address, certificates, host)
+    }
+    completionQueue = CompletionQueue(underlyingCompletionQueue:cgrpc_channel_completion_queue(underlyingChannel))
+    completionQueue.name = "Client" // only for debugging
+    self.completionQueue.run() // start a loop that watches the channel's completion queue
+  }
+
+  deinit {
+    cgrpc_channel_destroy(underlyingChannel)
+  }
+
+  /// Constructs a Call object to make a gRPC API call
+  ///
+  /// - Parameter method: the gRPC method name for the call
+  /// - Parameter host: the gRPC host name for the call. If unspecified, defaults to the Client host
+  /// - Parameter timeout: a timeout value in seconds
+  /// - Returns: a Call object that can be used to perform the request
+  public func makeCall(_ method:String, host:String="") -> Call {
+    let host = (host == "") ? self.host : host
+    let underlyingCall = cgrpc_channel_create_call(underlyingChannel, method, host, timeout)!
+    return Call(underlyingCall:underlyingCall, owned:true, completionQueue:self.completionQueue)
+  }
+}

+ 8 - 8
gRPC.xcodeproj/project.pbxproj

@@ -13,7 +13,7 @@
 		D37DD0281D7D09CB009AEB74 /* event.c in Sources */ = {isa = PBXBuildFile; fileRef = D37DD0271D7D09CB009AEB74 /* event.c */; };
 		D3AC86AE1D5BEBBE0042B341 /* byte_buffer.c in Sources */ = {isa = PBXBuildFile; fileRef = D3AC86A21D5BEBBE0042B341 /* byte_buffer.c */; };
 		D3AC86AF1D5BEBBE0042B341 /* call.c in Sources */ = {isa = PBXBuildFile; fileRef = D3AC86A31D5BEBBE0042B341 /* call.c */; };
-		D3AC86B01D5BEBBE0042B341 /* client.c in Sources */ = {isa = PBXBuildFile; fileRef = D3AC86A41D5BEBBE0042B341 /* client.c */; };
+		D3AC86B01D5BEBBE0042B341 /* channel.c in Sources */ = {isa = PBXBuildFile; fileRef = D3AC86A41D5BEBBE0042B341 /* channel.c */; };
 		D3AC86B11D5BEBBE0042B341 /* completion_queue.c in Sources */ = {isa = PBXBuildFile; fileRef = D3AC86A51D5BEBBE0042B341 /* completion_queue.c */; };
 		D3AC86B21D5BEBBE0042B341 /* handler.c in Sources */ = {isa = PBXBuildFile; fileRef = D3AC86A61D5BEBBE0042B341 /* handler.c */; };
 		D3AC86B31D5BEBBE0042B341 /* internal.c in Sources */ = {isa = PBXBuildFile; fileRef = D3AC86A71D5BEBBE0042B341 /* internal.c */; };
@@ -25,7 +25,7 @@
 		D3AC86B91D5BEBBE0042B341 /* cgrpc.h in Headers */ = {isa = PBXBuildFile; fileRef = D3AC86AD1D5BEBBE0042B341 /* cgrpc.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		D3AC86C51D5BEBE00042B341 /* ByteBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3AC86BB1D5BEBE00042B341 /* ByteBuffer.swift */; };
 		D3AC86C61D5BEBE00042B341 /* Call.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3AC86BC1D5BEBE00042B341 /* Call.swift */; };
-		D3AC86C71D5BEBE00042B341 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3AC86BD1D5BEBE00042B341 /* Client.swift */; };
+		D3AC86C71D5BEBE00042B341 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3AC86BD1D5BEBE00042B341 /* Channel.swift */; };
 		D3AC86C81D5BEBE00042B341 /* CompletionQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3AC86BE1D5BEBE00042B341 /* CompletionQueue.swift */; };
 		D3AC86C91D5BEBE00042B341 /* gRPC.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3AC86BF1D5BEBE00042B341 /* gRPC.swift */; };
 		D3AC86CA1D5BEBE00042B341 /* Handler.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3AC86C01D5BEBE00042B341 /* Handler.swift */; };
@@ -44,7 +44,7 @@
 		D37DD0271D7D09CB009AEB74 /* event.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = event.c; path = Packages/CgRPC/Sources/event.c; sourceTree = "<group>"; };
 		D3AC86A21D5BEBBE0042B341 /* byte_buffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = byte_buffer.c; path = Packages/CgRPC/Sources/byte_buffer.c; sourceTree = "<group>"; };
 		D3AC86A31D5BEBBE0042B341 /* call.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = call.c; path = Packages/CgRPC/Sources/call.c; sourceTree = "<group>"; };
-		D3AC86A41D5BEBBE0042B341 /* client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = client.c; path = Packages/CgRPC/Sources/client.c; sourceTree = "<group>"; };
+		D3AC86A41D5BEBBE0042B341 /* channel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = channel.c; path = Packages/CgRPC/Sources/channel.c; sourceTree = "<group>"; };
 		D3AC86A51D5BEBBE0042B341 /* completion_queue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = completion_queue.c; path = Packages/CgRPC/Sources/completion_queue.c; sourceTree = "<group>"; };
 		D3AC86A61D5BEBBE0042B341 /* handler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = handler.c; path = Packages/CgRPC/Sources/handler.c; sourceTree = "<group>"; };
 		D3AC86A71D5BEBBE0042B341 /* internal.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = internal.c; path = Packages/CgRPC/Sources/internal.c; sourceTree = "<group>"; };
@@ -56,7 +56,7 @@
 		D3AC86AD1D5BEBBE0042B341 /* cgrpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cgrpc.h; path = Packages/CgRPC/Sources/cgrpc.h; sourceTree = "<group>"; };
 		D3AC86BB1D5BEBE00042B341 /* ByteBuffer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ByteBuffer.swift; path = Packages/gRPC/Sources/ByteBuffer.swift; sourceTree = "<group>"; };
 		D3AC86BC1D5BEBE00042B341 /* Call.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; name = Call.swift; path = Packages/gRPC/Sources/Call.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
-		D3AC86BD1D5BEBE00042B341 /* Client.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Client.swift; path = Packages/gRPC/Sources/Client.swift; sourceTree = "<group>"; };
+		D3AC86BD1D5BEBE00042B341 /* Channel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; name = Channel.swift; path = Packages/gRPC/Sources/Channel.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
 		D3AC86BE1D5BEBE00042B341 /* CompletionQueue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CompletionQueue.swift; path = Packages/gRPC/Sources/CompletionQueue.swift; sourceTree = "<group>"; };
 		D3AC86BF1D5BEBE00042B341 /* gRPC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = gRPC.swift; path = Packages/gRPC/Sources/gRPC.swift; sourceTree = "<group>"; };
 		D3AC86C01D5BEBE00042B341 /* Handler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; name = Handler.swift; path = Packages/gRPC/Sources/Handler.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
@@ -88,7 +88,7 @@
 				D3AC86A21D5BEBBE0042B341 /* byte_buffer.c */,
 				D3AC86A31D5BEBBE0042B341 /* call.c */,
 				D3AC86AD1D5BEBBE0042B341 /* cgrpc.h */,
-				D3AC86A41D5BEBBE0042B341 /* client.c */,
+				D3AC86A41D5BEBBE0042B341 /* channel.c */,
 				D3AC86A51D5BEBBE0042B341 /* completion_queue.c */,
 				D37DD0271D7D09CB009AEB74 /* event.c */,
 				D3AC86A61D5BEBBE0042B341 /* handler.c */,
@@ -108,7 +108,7 @@
 			children = (
 				D3AC86BB1D5BEBE00042B341 /* ByteBuffer.swift */,
 				D3AC86BC1D5BEBE00042B341 /* Call.swift */,
-				D3AC86BD1D5BEBE00042B341 /* Client.swift */,
+				D3AC86BD1D5BEBE00042B341 /* Channel.swift */,
 				D3AC86BE1D5BEBE00042B341 /* CompletionQueue.swift */,
 				D3AC86BF1D5BEBE00042B341 /* gRPC.swift */,
 				D3AC86C01D5BEBE00042B341 /* Handler.swift */,
@@ -246,7 +246,7 @@
 				D3AC86AE1D5BEBBE0042B341 /* byte_buffer.c in Sources */,
 				D34B4BBA1D7B2CB200B8B5E2 /* operations.c in Sources */,
 				D3AC86AF1D5BEBBE0042B341 /* call.c in Sources */,
-				D3AC86B01D5BEBBE0042B341 /* client.c in Sources */,
+				D3AC86B01D5BEBBE0042B341 /* channel.c in Sources */,
 				D3AC86B11D5BEBBE0042B341 /* completion_queue.c in Sources */,
 				D3AC86B21D5BEBBE0042B341 /* handler.c in Sources */,
 				D3AC86B31D5BEBBE0042B341 /* internal.c in Sources */,
@@ -263,7 +263,7 @@
 				D3AC86CD1D5BEBE00042B341 /* Operation.swift in Sources */,
 				D37DD0281D7D09CB009AEB74 /* event.c in Sources */,
 				D3AC86CE1D5BEBE00042B341 /* Server.swift in Sources */,
-				D3AC86C71D5BEBE00042B341 /* Client.swift in Sources */,
+				D3AC86C71D5BEBE00042B341 /* Channel.swift in Sources */,
 				D3AC86C51D5BEBE00042B341 /* ByteBuffer.swift in Sources */,
 				D3AC86CC1D5BEBE00042B341 /* Mutex.swift in Sources */,
 			);