program.cpp 2.84 KB
Newer Older
1 2 3 4
/*****************************************************************************
 * program.cpp : SAP Program class
 ****************************************************************************
 * Copyright (C) 1998-2002 VideoLAN
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
5
 * $Id$
6 7
 *
 * Authors: Damien Lucas <nitrox@videolan.org>
8
 *          Philippe Van Hecke <philippe.vanhecke@belnet.be>
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************/

25 26 27 28
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

29 30 31 32 33 34 35 36 37 38 39
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;

#include "program.h"

40
Program::Program() : b_rtp(false), b_has_pl_group(false)
41
{
42
    /* Set default Values */
43
    address="";
44
    port=0;
45
    permanent = true;
46
    program_ttl = "255";
47 48 49
    machine = "localhost";
    user = "VideoLAN";
    site = "http://www.videolan.org";
50
}
51 52 53 54 55 56 57
Program::~Program() {return;}

string Program::GetName(void) {return name;}
string Program::GetUser(void) {return user;}
string Program::GetMachine(void) {return machine;}
string Program::GetSite(void) {return site;}
string Program::GetAddress(void){return address;}
58
uint16_t Program::GetPort(void){return port;}
59
string Program::GetTTL(void){return program_ttl;}
60
string Program::GetPlGroup(void){return pl_group;}
61

62
bool   Program::IsPermanent(void){return permanent;}
63
bool   Program::IsRTP(void){return b_rtp;}
64
bool   Program::HasPlGroup(void){return b_has_pl_group;}
65

66 67 68 69 70 71
void Program::SetName(const char* n){name=n;}
void Program::SetUser(const char* u){user=u;}
void Program::SetMachine(const char* m){machine=m;}
void Program::SetSite(const char* s){site=s;}
void Program::SetAddress(const char* a){address=a;}
void Program::SetPlGroup(const char *h){pl_group=h;}
72
void Program::SetRTP(bool b){b_rtp = b;}
73
void Program::SetHasPlGroup(bool b){b_has_pl_group = b ;}
74
void Program::SetPort(uint16_t p) { port = p; }
75

76
void Program::SetTTL(const char *p){program_ttl=p;}
77

78
Program::Program(string n, string u, string m, string s, string a,uint16_t p)
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
79
    : b_has_pl_group (false)
80 81 82 83 84 85
{
    name=n;
    user=u;
    machine=m;
    site=s;
    address=a;
86
    port=p;
87
    permanent=true;
88
}