HTTP Client Library: D:/CC3xxx/CC3100/CC3100 SDK/CC3100 1.1.0/sdk/netapps/http/client/ssock.h Source File

TI HTTP Client Library

ssock.h
1 /*
2  * Copyright (c) 2014, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 #ifndef _SSOCK_H_
33 #define _SSOCK_H_
34 
35 #include <stdint.h>
36 #include <http/client/network.h>
37 
38 #define Ssock_TIMEOUT (-11)
39 
40 typedef ssize_t (*Ssock_EncryptFxn)(const void * ctx, uint8_t * oct,
41  const uint8_t * ipt, size_t len);
42 
43 typedef ssize_t (*Ssock_SendFxn)(const void * ctx, int s, const void * buf,
44  size_t len, int flags);
45 
46 typedef ssize_t (*Ssock_DecryptFxn)(const void * ctx, uint8_t * opt,
47  const uint8_t * ict, size_t len);
48 
49 typedef ssize_t (*Ssock_RecvFxn)(void * ctx, int s, void * buf,
50  size_t len, int flags);
51 
52 typedef void (*Ssock_DeleteFxn)(void * ctx);
53 
54 typedef struct Ssock_SecureFxns {
55  Ssock_EncryptFxn encrypt;
56  Ssock_DecryptFxn decrypt;
57  Ssock_SendFxn send;
58  Ssock_RecvFxn recv;
59  Ssock_DeleteFxn del;
60  int32_t extraBytes;
62 
63 typedef struct Ssock_Struct {
64  int s;
65  Ssock_SecureFxns sec;
66  void * ctx;
67 } Ssock_Struct;
68 
69 typedef struct Ssock_Struct * Ssock_Handle;
70 
71 extern void Ssock_construct(Ssock_Struct * ssockP, int s);
72 
73 extern Ssock_Handle Ssock_create(int s);
74 
75 extern void Ssock_delete(Ssock_Handle * ss);
76 
77 extern void Ssock_destruct(Ssock_Struct * ssockP);
78 
79 extern int Ssock_getSocket(Ssock_Handle ss);
80 
81 extern ssize_t Ssock_recv(Ssock_Handle ss, void * buf, size_t len, int flags);
82 
83 extern ssize_t Ssock_recvall(Ssock_Handle ssock, void * buf, size_t len,
84  int flags);
85 
86 extern ssize_t Ssock_send(Ssock_Handle ss, const void * buf, size_t len,
87  int flags);
88 
89 extern int Ssock_startSecure(Ssock_Handle ss, Ssock_SecureFxns * sec,
90  void * ctx);
91 
92 #endif /* _SSOCK_H */
Definition: ssock.h:54
Definition: ssock.h:63
Generated on Tue Jan 13 2015 14:42:03 for HTTP Client Library by   doxygen 1.8.9.1