aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_oss.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-01 23:05:28 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-01 23:05:28 +0000
commit21d21f89c04ebaad6822311ceadd13275b357513 (patch)
tree86a6664b5cba70b924fdd1cef2ecbf93226e7d58 /channels/chan_oss.c
parent4d4470fe1560a6d00b17db78798f0cc9790fe74b (diff)
use string fields for some stuff in ast_channel
const-ify some more APIs remove 'type' field from ast_channel, in favor of the one in the channel's tech structure allow string field module users to specify the 'chunk size' for pool allocations update chan_alsa to be compatible with recent const-ification patches git-svn-id: http://svn.digium.com/svn/asterisk/trunk@9060 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_oss.c')
-rw-r--r--channels/chan_oss.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index bbfa70ac6..858411de7 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -69,6 +69,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/causes.h"
#include "asterisk/endian.h"
+#include "asterisk/stringfields.h"
/* ringtones we use */
#include "busy.h"
@@ -247,7 +248,6 @@ static struct sound sounds[] = {
struct chan_oss_pvt {
struct chan_oss_pvt *next;
- char *type; /* XXX maybe take the one from oss_tech */
char *name;
/*
* cursound indicates which in struct sound we play. -1 means nothing,
@@ -303,7 +303,6 @@ struct chan_oss_pvt {
};
static struct chan_oss_pvt oss_default = {
- .type = "Console",
.cursound = -1,
.sounddev = -1,
.duplex = M_UNSET, /* XXX check this */
@@ -334,19 +333,19 @@ static int oss_indicate(struct ast_channel *chan, int cond);
static int oss_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
static const struct ast_channel_tech oss_tech = {
- .type = "Console",
+ .type = "Console",
.description = "OSS Console Channel Driver",
.capabilities = AST_FORMAT_SLINEAR,
- .requester = oss_request,
- .send_digit = oss_digit,
- .send_text = oss_text,
- .hangup = oss_hangup,
- .answer = oss_answer,
- .read = oss_read,
- .call = oss_call,
- .write = oss_write,
- .indicate = oss_indicate,
- .fixup = oss_fixup,
+ .requester = oss_request,
+ .send_digit = oss_digit,
+ .send_text = oss_text,
+ .hangup = oss_hangup,
+ .answer = oss_answer,
+ .read = oss_read,
+ .call = oss_call,
+ .write = oss_write,
+ .indicate = oss_indicate,
+ .fixup = oss_fixup,
};
/*
@@ -807,7 +806,7 @@ static struct ast_frame *oss_read(struct ast_channel *c)
/* prepare a NULL frame in case we don't have enough data to return */
bzero(f, sizeof(struct ast_frame));
f->frametype = AST_FRAME_NULL;
- f->src = o->type;
+ f->src = oss_tech.type;
res = read(o->sounddev, o->oss_read_buf + o->readpos,
sizeof(o->oss_read_buf) - o->readpos);
@@ -884,8 +883,7 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o,
if (c == NULL)
return NULL;
c->tech = &oss_tech;
- snprintf(c->name, sizeof(c->name), "OSS/%s", o->device + 5);
- c->type = o->type;
+ ast_string_field_build(c, name, "OSS/%s", o->device + 5);
c->fds[0] = o->sounddev; /* -1 if device closed, override later */
c->nativeformats = AST_FORMAT_SLINEAR;
c->readformat = AST_FORMAT_SLINEAR;
@@ -897,7 +895,7 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o,
if (!ast_strlen_zero(ext))
ast_copy_string(c->exten, ext, sizeof(c->exten));
if (!ast_strlen_zero(o->language))
- ast_copy_string(c->language, o->language, sizeof(c->language));
+ ast_string_field_set(c, language, o->language);
if (!ast_strlen_zero(o->cid_num))
c->cid.cid_num = ast_strdup(o->cid_num);
if (!ast_strlen_zero(o->cid_name))
@@ -1403,8 +1401,7 @@ int load_module(void)
}
i = ast_channel_register(&oss_tech);
if (i < 0) {
- ast_log(LOG_ERROR, "Unable to register channel class '%s'\n",
- oss_default.type);
+ ast_log(LOG_ERROR, "Unable to register channel class 'Console'\n");
/* XXX should cleanup allocated memory etc. */
return -1;
}