1/* 2 * ---------------------------------------------------------------------- 3 * ChangeList: 4 * 2000/12/21 Vincent 002 5 * Add _PRINTER_FILTER_ define. 6 * We need to read the "printer_client=laserwriter" from "/etc/CGI_ds.conf". 7 * If it were "laserwriter", we would write ":if=/share/spool/filter:" in 8 * "/etc/printcap" file. Otherwise, we need to remove this line. 9 * This action was used to be done by the Perl CGI program. Now the C CGI 10 * won't do this action. We will do it in the Samba/Netatalk Module. 11 * 2002/5/3 Vincent 001 12 * Add _LINKSYS_G2_ define. If Linksys G2 server, use LKGxxxxxx as its default 13 * server name. (Also default printer name) 14 * ---------------------------------------------------------------------- 15 */ 16#ifndef _NET_SAMBA_ 17#define _NET_SAMBA_ 18 19/* ---------- Global Parameter ----------*/ 20#ifndef _NET_SMBERRNO_ 21#define _NET_SMBERRNO_ 22 23#define SMB_OK 0 /* action succeed */ 24#define SMB_ERROR -1 /* action fail */ 25#define SMB_EFILEOPEN -2 /* file open error */ 26#define SMB_EFILEREAD -3 /* file read error */ 27#define SMB_EFILEWRITE -4 /* file write error */ 28#define SMB_ESECTION -5 /* input section error */ 29#define SMB_EFIELD -6 /* input field error */ 30#define SMB_ELEN -7 /* input length error */ 31#define SMB_EWGROUP -8 /* workgroup invalid */ 32#define SMB_EPRINTER -9 /* printer parameter invalid */ 33 34#endif 35 36/* ---------- Global Parameter ----------*/ 37#include "NET_global.h" /* our global definition */ 38 39#define DEF_SMB_WORKGROUP "workgroup" /* default value */ 40/* FIXME: The default printer name should be the same as our 1st boot setting: SCxxxxxx_p1. "lp" is for backup reason. (If we can't get DS default server name.) It should declare as the same as Netatalk Module. (NET_netatalk.h) */ 41#ifdef _LINKSYS_G2_ /* Tony 001 - add #ifdef _LINKSYS_G2_ */ 42#define DEF_SMB_PRINTERNAME_LEN 12 /* LKGxxxxxx_p1 */ 43#else 44#define DEF_SMB_PRINTERNAME_LEN 11 /* SCxxxxxx_p1 */ 45#endif 46#define DEF_SMB_PRINTERNAME "lp" 47#ifdef _FW_MACNICA_ 48#define DEF_SMB_CODEPAGE "932" /* Japanese */ 49#else 50#define DEF_SMB_CODEPAGE "437" /* English */ 51#endif 52#define DEF_SMB_RESOLVEORDER "wins bcast" 53 /* files: configuration */ 54#define SMB_SAMBA_CONF "/etc/samba/smb.conf" 55#define SMB_PRINTCAP_CONF "/etc/printcap" 56 57 /* files: executive */ 58#ifndef _OFF_STDOUT_ 59#define SMB_SAMBA_EXE "/etc/rc.d/rc.samba" 60#else 61#define SMB_SAMBA_EXE "/etc/rc.d/rc.samba &>/dev/null" 62#endif 63 64/* ---------- Structure Declaration ---------- */ 65 66/* ----- Samba information ----- */ 67#define SMB_COMMENT_LEN 48 68#define SMB_WORKGROUP_LEN 15 /* linux support up to 16 */ 69#define SMB_CODEPAGE_LEN 5 /* dhcp or none/static */ 70/* the following 2 declarations MUST be the same in samba/netatalk */ 71#define SMB_PRINTER_LEN 12 /* it MUST be the same in samba/netatalk */ 72#define SMB_PRINTERCOMMENT_LEN 80 /* comment for SMB information */ 73#ifndef NO_PRINTER 74 #define NO_PRINTER 75#endif 76 77typedef struct { 78 char SAMBA[STR_BOOLEAN_LEN+1]; /* msn_enable */ 79 char COMMENT[SMB_COMMENT_LEN+1]; /* disk_server_comment */ 80 char WORKGROUP[SMB_WORKGROUP_LEN+1]; /* w_d_name */ 81 char CODEPAGE[SMB_CODEPAGE_LEN+1]; /* code_page */ 82#ifndef NO_PRINTER 83 char PRINTERNAME[SMB_PRINTER_LEN+1]; /* print_name */ 84 char SMBPRINTERCOMMENT[SMB_PRINTERCOMMENT_LEN+1]; /* print_comment */ 85#endif 86 char SMBWINSSERVER[STR_IPADDR_LEN+1]; /* wins_server */ 87} SMBInfo; 88 89#ifdef _PRINTER_FILTER_ /* Vincent 002 - add #ifdef _PRINTER_FILTER_ */ 90/* The following declaration MUST be the same as NET_netatalk.h */ 91#define SMB_APPLE_LASERWRITER "LaserWriter" 92#define SMB_MAC_PRINTNAME_LEN 32 /* LaserWriter or OtherPrn */ 93 94typedef struct { 95 char SMBMACPRINTERNAME[SMB_MAC_PRINTNAME_LEN+1]; /* printer_client */ 96} SMBPrinterInfo; 97int SMBWritePrinterFilterData(SMBPrinterInfo *info); 98#endif 99 100/* ----------------------------------------------------------------------*/ 101/* purpose : Set samba daemon */ 102/* return : 0 -success */ 103/* others - failed */ 104/* Note : Enable/Disable samba daemon, pass "enable" or "disable". */ 105/* If pass "yes" or "no",it will return SMB_ERROR(-1). */ 106/*-----------------------------------------------------------------------*/ 107int SMBSetSamba(SMBInfo *info); 108 109#endif 110