Virgin import of NgATM shared kernel/user part 1.1

This commit is contained in:
Hartmut Brandt 2004-08-11 12:21:36 +00:00
parent 36919bb12f
commit e42ab7cde1
11 changed files with 67 additions and 65 deletions

View File

@ -31,7 +31,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Begemot: libunimsg/netnatm/api/cc_conn.c,v 1.1 2004/07/08 08:21:49 brandt Exp $
* $Begemot: libunimsg/netnatm/api/cc_conn.c,v 1.2 2004/07/16 18:45:11 brandt Exp $
*
* ATM API as defined per af-saa-0108
*
@ -139,7 +139,7 @@ cc_send_uni(struct ccconn *conn, u_int op, struct uni_msg *msg)
if (r == NULL) {
if (msg != NULL)
uni_msg_destroy(msg);
cc_conn_log(conn, "no memory for cookie");
cc_conn_log(conn, "no memory for cookie op=%u", op);
return;
}

View File

@ -27,7 +27,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Begemot: libunimsg/netnatm/api/cc_dump.c,v 1.1 2004/07/08 08:21:51 brandt Exp $
* $Begemot: libunimsg/netnatm/api/cc_dump.c,v 1.3 2004/08/05 07:10:56 brandt Exp $
*
* ATM API as defined per af-saa-0108
*/
@ -43,7 +43,7 @@
#ifdef _KERNEL
#ifdef __FreeBSD__
#include <sys/stdarg.h>
#include <machine/stdarg.h>
#endif
#else /* !_KERNEL */
#include <stdarg.h>
@ -84,7 +84,7 @@ cc_dumpf(struct dump *d, const char *fmt, ...)
va_end(ap);
if (n < 0) {
d->ret = errno;
d->ret = CCGETERRNO();
return;
}
if ((size_t)n < d->maxsiz - d->len) {
@ -105,7 +105,7 @@ cc_dumpf(struct dump *d, const char *fmt, ...)
va_end(ap);
if (n < 0) {
d->ret = errno;
d->ret = CCGETERRNO();
return;
}
if ((size_t)n >= d->maxsiz) {
@ -123,18 +123,18 @@ static void
cc_dump_sap(struct dump *d, const struct uni_sap *sap)
{
static const char *const tagtab[] = {
[UNISVE_ABSENT] "absent",
[UNISVE_ANY] "any",
[UNISVE_PRESENT]"present"
[UNISVE_ABSENT] = "absent",
[UNISVE_ANY] = "any",
[UNISVE_PRESENT] = "present"
};
static const char *const plantab[] = {
[UNI_ADDR_E164] "E164",
[UNI_ADDR_ATME] "ATME",
[UNI_ADDR_E164] = "E164",
[UNI_ADDR_ATME] = "ATME",
};
static const char *const hlitab[] = {
[UNI_BHLI_ISO] "ISO",
[UNI_BHLI_VENDOR] "VENDOR",
[UNI_BHLI_USER] "USER"
[UNI_BHLI_ISO] = "ISO",
[UNI_BHLI_VENDOR] = "VENDOR",
[UNI_BHLI_USER] = "USER"
};
u_int i;

View File

@ -31,7 +31,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Begemot: libunimsg/netnatm/api/cc_user.c,v 1.2 2004/07/08 09:17:18 brandt Exp $
* $Begemot: libunimsg/netnatm/api/cc_user.c,v 1.3 2004/07/16 18:46:55 brandt Exp $
*
* ATM API as defined per af-saa-0108
*
@ -1297,6 +1297,7 @@ cc_user_sig_handle(struct ccuser *user, enum user_sig sig,
/* connection has disappeared. Send an ok
* to the user and lock whether there is another
* connection at this endpoint */
uni_msg_destroy(msg);
cc_user_ok(user, ATMRESP_NONE, NULL, 0);
set_state(user, USER_IN_WAITING);
@ -1359,6 +1360,7 @@ cc_user_sig_handle(struct ccuser *user, enum user_sig sig,
/* connection has disappeared. Send an error
* to the user and lock whether there is another
* connection at this endpoint */
uni_msg_destroy(msg);
cc_user_err(user, ATMERR_PREVIOUSLY_ABORTED);
set_state(user, USER_IN_WAITING);
@ -1370,15 +1372,14 @@ cc_user_sig_handle(struct ccuser *user, enum user_sig sig,
LIST_FOREACH(newep, &user->cc->user_list, node_link)
if (strcmp(acc->newep, newep->name) == 0)
break;
uni_msg_destroy(msg);
if (newep == NULL) {
uni_msg_destroy(msg);
cc_user_err(user, ATMERR_BAD_ENDPOINT);
return;
}
if (newep->state != USER_NULL || newep->accepted != NULL) {
uni_msg_destroy(msg);
cc_user_err(user, ATMERR_BAD_STATE);
return;
}

View File

@ -26,7 +26,7 @@
*
* Author: Hartmut Brandt <harti@freebsd.org>
*
* $Begemot: libunimsg/netnatm/msg/uni_ie.c,v 1.14 2004/07/08 08:22:06 brandt Exp $
* $Begemot: libunimsg/netnatm/msg/uni_ie.c,v 1.15 2004/08/05 07:10:59 brandt Exp $
*
* Private definitions for the IE code file.
*
@ -792,11 +792,11 @@ uni_print_cx(char *buf, size_t size, struct unicx *cx)
};
static const char *errtab[] = {
[UNI_IERR_UNK] "unk", /* unknown IE */
[UNI_IERR_LEN] "len", /* length error */
[UNI_IERR_BAD] "bad", /* content error */
[UNI_IERR_ACC] "acc", /* access element discarded */
[UNI_IERR_MIS] "mis", /* missing IE */
[UNI_IERR_UNK] = "unk", /* unknown IE */
[UNI_IERR_LEN] = "len", /* length error */
[UNI_IERR_BAD] = "bad", /* content error */
[UNI_IERR_ACC] = "acc", /* access element discarded */
[UNI_IERR_MIS] = "mis", /* missing IE */
};
u_int i;
@ -844,7 +844,7 @@ static const struct causetab {
enum uni_diag diag;
} itu_causes[128] = {
#define D(NAME,VAL,DIAG,STD,STR) [UNI_CAUSE_##NAME] { STR, UNI_DIAG_##DIAG },
#define D(NAME,VAL,DIAG,STD,STR) [UNI_CAUSE_##NAME] = { STR, UNI_DIAG_##DIAG },
#define N(NAME,VAL,DIAG,STD,STR)
UNI_DECLARE_CAUSE_VALUES
@ -855,7 +855,7 @@ UNI_DECLARE_CAUSE_VALUES
}, net_causes[128] = {
#define D(NAME,VAL,DIAG,STD,STR)
#define N(NAME,VAL,DIAG,STD,STR) [UNI_CAUSE_##NAME] { STR, UNI_DIAG_##DIAG },
#define N(NAME,VAL,DIAG,STD,STR) [UNI_CAUSE_##NAME] = { STR, UNI_DIAG_##DIAG },
UNI_DECLARE_CAUSE_VALUES

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Begemot: libunimsg/netnatm/msg/unistruct.h,v 1.6 2004/07/08 08:22:08 brandt Exp $
* $Begemot: libunimsg/netnatm/msg/unistruct.h,v 1.7 2004/07/16 18:42:22 brandt Exp $
*
* This file defines all structures that are used by
* API users.
@ -206,10 +206,11 @@ enum uni_addr_screen {
UNI_ADDR_SCREEN_NET = 0x3,
};
/* don't use bitfields to get a defined structure layout */
struct uni_addr {
enum uni_addr_type type;
enum uni_addr_plan plan;
u_int len;
uint8_t type;
uint8_t plan;
uint8_t len;
u_char addr[UNI_ADDR_MAXLEN];
};
struct uni_subaddr {

View File

@ -26,7 +26,7 @@
*
* Author: Hartmut Brandt <harti@freebsd.org>
*
* $Begemot: libunimsg/netnatm/sig/sig_call.c,v 1.64 2004/07/08 08:22:19 brandt Exp $
* $Begemot: libunimsg/netnatm/sig/sig_call.c,v 1.65 2004/08/05 07:11:00 brandt Exp $
*
* Call instance handling
*
@ -51,7 +51,7 @@ static enum call_state state_compat(struct call *, enum uni_callstate);
static void respond_drop_party_ack(struct call *, struct uni_ie_epref *, u_int);
#define DEF_PRIV_SIG(NAME, FROM) [SIG##NAME] "SIG"#NAME,
#define DEF_PRIV_SIG(NAME, FROM) [SIG##NAME] = "SIG"#NAME,
static const char *const call_sigs[] = {
DEF_CALL_SIGS
};
@ -65,27 +65,27 @@ TIMER_FUNC_CALL(t313, t313_func)
TIMER_FUNC_CALL(t322, t322_func)
const struct callstates callstates[] = {
[CALLST_NULL] { "NU0", UNI_CALLSTATE_U0 },
[CALLST_U1] { "U1", UNI_CALLSTATE_U1 },
[CALLST_U3] { "U3", UNI_CALLSTATE_U3 },
[CALLST_U4] { "U4", UNI_CALLSTATE_U4 },
[CALLST_U6] { "U6", UNI_CALLSTATE_U6 },
[CALLST_U7] { "U7", UNI_CALLSTATE_U7 },
[CALLST_U8] { "U8", UNI_CALLSTATE_U8 },
[CALLST_U9] { "U9", UNI_CALLSTATE_U9 },
[CALLST_U10] { "U10", UNI_CALLSTATE_U10 },
[CALLST_U11] { "U11", UNI_CALLSTATE_U11 },
[CALLST_U12] { "U12", UNI_CALLSTATE_U12 },
[CALLST_N1] { "N1", UNI_CALLSTATE_N1 },
[CALLST_N3] { "N3", UNI_CALLSTATE_N3 },
[CALLST_N4] { "N4", UNI_CALLSTATE_N4 },
[CALLST_N6] { "N6", UNI_CALLSTATE_N6 },
[CALLST_N7] { "N7", UNI_CALLSTATE_N7 },
[CALLST_N8] { "N8", UNI_CALLSTATE_N8 },
[CALLST_N9] { "N9", UNI_CALLSTATE_N9 },
[CALLST_N10] { "N10", UNI_CALLSTATE_N10 },
[CALLST_N11] { "N11", UNI_CALLSTATE_N11 },
[CALLST_N12] { "N12", UNI_CALLSTATE_N12 },
[CALLST_NULL] = { "NU0", UNI_CALLSTATE_U0 },
[CALLST_U1] = { "U1", UNI_CALLSTATE_U1 },
[CALLST_U3] = { "U3", UNI_CALLSTATE_U3 },
[CALLST_U4] = { "U4", UNI_CALLSTATE_U4 },
[CALLST_U6] = { "U6", UNI_CALLSTATE_U6 },
[CALLST_U7] = { "U7", UNI_CALLSTATE_U7 },
[CALLST_U8] = { "U8", UNI_CALLSTATE_U8 },
[CALLST_U9] = { "U9", UNI_CALLSTATE_U9 },
[CALLST_U10] = { "U10", UNI_CALLSTATE_U10 },
[CALLST_U11] = { "U11", UNI_CALLSTATE_U11 },
[CALLST_U12] = { "U12", UNI_CALLSTATE_U12 },
[CALLST_N1] = { "N1", UNI_CALLSTATE_N1 },
[CALLST_N3] = { "N3", UNI_CALLSTATE_N3 },
[CALLST_N4] = { "N4", UNI_CALLSTATE_N4 },
[CALLST_N6] = { "N6", UNI_CALLSTATE_N6 },
[CALLST_N7] = { "N7", UNI_CALLSTATE_N7 },
[CALLST_N8] = { "N8", UNI_CALLSTATE_N8 },
[CALLST_N9] = { "N9", UNI_CALLSTATE_N9 },
[CALLST_N10] = { "N10", UNI_CALLSTATE_N10 },
[CALLST_N11] = { "N11", UNI_CALLSTATE_N11 },
[CALLST_N12] = { "N12", UNI_CALLSTATE_N12 },
};
static void unx_send_add_party_rej(struct call *c, struct uni_all *u);

View File

@ -26,7 +26,7 @@
*
* Author: Hartmut Brandt <harti@freebsd.org>
*
* $Begemot: libunimsg/netnatm/sig/sig_coord.c,v 1.11 2004/07/08 08:22:20 brandt Exp $
* $Begemot: libunimsg/netnatm/sig/sig_coord.c,v 1.12 2004/08/05 07:11:01 brandt Exp $
*
* Coordinator
*/
@ -40,7 +40,7 @@
#include <netnatm/sig/unipriv.h>
#include <netnatm/sig/unimkmsg.h>
#define STR(S) [S] #S
#define STR(S) [S] = #S
static const char *const cunames[] = {
STR(CU_STAT0),
STR(CU_STAT1),
@ -48,7 +48,7 @@ static const char *const cunames[] = {
STR(CU_STAT3),
};
#define DEF_PRIV_SIG(NAME, FROM) [SIG##NAME] "SIG"#NAME,
#define DEF_PRIV_SIG(NAME, FROM) [SIG##NAME] = "SIG"#NAME,
static const char *const coord_sigs[] = {
DEF_COORD_SIGS
};

View File

@ -26,7 +26,7 @@
*
* Author: Hartmut Brandt <harti@freebsd.org>
*
* $Begemot: libunimsg/netnatm/sig/sig_party.c,v 1.17 2004/07/08 08:22:21 brandt Exp $
* $Begemot: libunimsg/netnatm/sig/sig_party.c,v 1.18 2004/08/05 07:11:01 brandt Exp $
*
* Party instance handling
*/
@ -44,7 +44,7 @@
static void drop_partyE(struct party *p);
static int epstate_compat(struct party *, enum uni_epstate);
#define DEF_PRIV_SIG(NAME, FROM) [SIG##NAME] "SIG"#NAME,
#define DEF_PRIV_SIG(NAME, FROM) [SIG##NAME] = "SIG"#NAME,
static const char *const party_sigs[] = {
DEF_PARTY_SIGS
};

View File

@ -27,7 +27,7 @@
* Author: Hartmut Brandt <harti@freebsd.org>
* Kendy Kutzner <kutzner@fokus.fraunhofer.de>
*
* $Begemot: libunimsg/netnatm/sig/sig_print.c,v 1.5 2004/07/08 08:22:22 brandt Exp $
* $Begemot: libunimsg/netnatm/sig/sig_print.c,v 1.6 2004/08/05 07:11:02 brandt Exp $
*/
#include <sys/types.h>
@ -56,7 +56,7 @@ const char *
uni_strerr(u_int err)
{
static const char *const errstr[] = {
#define DEF(NAME, VAL, STR) [UNIAPI_##NAME] STR,
#define DEF(NAME, VAL, STR) [UNIAPI_##NAME] = STR,
UNIAPI_DEF_ERRORS(DEF)
#undef DEF
};
@ -69,7 +69,7 @@ UNIAPI_DEF_ERRORS(DEF)
return (errstr[err]);
}
#define D(M) [M] #M
#define D(M) [M] = #M
static const char *const msgs[] = {
D(UNIAPI_ERROR),
D(UNIAPI_CALL_CREATED),

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Begemot: libunimsg/netnatm/sig/sig_reset.c,v 1.10 2004/07/08 08:22:22 brandt Exp $
* $Begemot: libunimsg/netnatm/sig/sig_reset.c,v 1.11 2004/08/05 07:11:03 brandt Exp $
*
* Reset-start and reset-respond
*/
@ -60,13 +60,13 @@ static void start_status(struct uni *, struct uni_msg *, struct uni_all *);
static int restart_forward(struct uni *, const struct uni_all *);
#define DEF_PRIV_SIG(NAME, FROM) [SIG##NAME] "SIG"#NAME,
#define DEF_PRIV_SIG(NAME, FROM) [SIG##NAME] = "SIG"#NAME,
static const char *const start_sigs[] = {
DEF_START_SIGS
};
#undef DEF_PRIV_SIG
#define DEF_PRIV_SIG(NAME, FROM) [SIG##NAME] "SIG"#NAME,
#define DEF_PRIV_SIG(NAME, FROM) [SIG##NAME] = "SIG"#NAME,
static const char *const respond_sigs[] = {
DEF_RESPOND_SIGS
};

View File

@ -26,7 +26,7 @@
*
* Author: Hartmut Brandt <harti@freebsd.org>
*
* $Begemot: libunimsg/netnatm/sig/sig_uni.c,v 1.10 2004/07/08 08:22:23 brandt Exp $
* $Begemot: libunimsg/netnatm/sig/sig_uni.c,v 1.11 2004/08/05 07:11:03 brandt Exp $
*
* Instance handling
*/
@ -45,7 +45,7 @@
UNICORE
#endif
#define STR(S) [S] #S
#define STR(S) [S] = #S
static const char *custat_names[] = {
STR(CU_STAT0),
STR(CU_STAT1),